CodeIgniter Forums

Full Version: Form Validation - checking integer values (greater than, less than)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]thbt[/eluser]
There must be an easy way to check if integer values are within range... something like

$rules['amount'] = "trim|required|min_val[5]|max_val[12]";

Anyone know an easy way to do this?

El Forum

[eluser]Phil Sturgeon[/eluser]
You just need to extend the Validation class (as it looks like you are using it over the new 1.7 Form Validation class, even though the idea is the same).

We had a wiki page for collecting our validation extensions, that seemed to vanish. Here is one of my old posts about it.

Post: Less Than, Greater Than, Equal to in Validation

El Forum

[eluser]Phil Sturgeon[/eluser]
Ahh here we go.

There is LOTS more on here than you will need, but some of them may be handy.

Wiki: MY_Validation

El Forum

[eluser]thbt[/eluser]
Nice, I like. Thanks!