New IS_IPV4 validator checks if field's value is an IP version 4 address in decimal form.
Can be set to force adresses from certain range.
INPUT(_type='text',_name='name',requires=IS_IPV4(minip='0.0.0.0',
maxip='255.255.255.255'),
error_message='invalid IPv4
address!'))
All three example values are equal, since addresses are converted to integers for inclusion check with following function:
number = 16777216 * IP[0] + 65536 * IP[1] + 256 * IP[2] + IP[3]
Examples:
Check for valid IPv4 address:
INPUT(_type='text',_name='name',requires=IS_IPV4())
Check for valid private network IPv4 address:
INPUT(_type='text',_name='name',requires=IS_IPV4(minip='192.168.0.1',
maxip='192.168.255.255'))