Invalid helper - check for single value


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.

How about same?

1 Like

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.


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