Invalid helper - check for single value


#1

Hello,

I’m using the invalid helper on my front end form. I just need to check if an exact value (12 in this case) has been entered. Here’s what I have and this works, but isn’t there a better way?

'ruhuman' => array('required', 'max' => 12, 'min' => 12),

Any help would be appreciated. Thanks.


#2

How about same?


#3

The following doesn’t seem to work here.

'ruhuman' => array('required', 'same' => 12)

I fussed around a bit and found that the following works.

'ruhuman' => array('required', 'same' == '12')

Notice the use of the == and quotes around the number.

Thanks.


#4

seems like input from form is a string. maybe check and cast before validating?