Welcome Guest, Not a member yet? Register   Sign In
How can i allow 1 to 100 numbers only using validation rules?
#1

[eluser]suba[/eluser]
Hi all,

I want to allow only 1 to 100 numbers only.

so how can i set in validation rules?
#2

[eluser]rogierb[/eluser]
There is no standard rule that does this. So you need to create a callback function that checks the number.

See http://ellislab.com/codeigniter/user-gui...#callbacks
for more information on callbacks.


Next to the callback, you can use the 'integer' rule
#3

[eluser]erik.brannstrom[/eluser]
You could do it if you're okay with only values 0 to 99. If you set the validation to "max_length[2]|is_natural" this would make sure you have a natural number (i.e. 0, 1, 2 etc) that isn't longer than two characters, giving you a maximum of 99.
#4

[eluser]suba[/eluser]
Hi ,

Thanks.

But I want 1 to 100 only.
#5

[eluser]erik.brannstrom[/eluser]
Then rogierb gave you the answer Smile




Theme © iAndrew 2016 - Forum software by © MyBB