Tuesday, July 30, 2013

Re: 2.3 Checkbox validation

Why are you not using 0/1 (the numeric representation of boolean false/true) here?
Would make your life so much easier. And the validaiton rule here.

Also, boolean checkboxes by default would use those values anyway if you let them.



Am Dienstag, 30. Juli 2013 18:14:53 UTC+2 schrieb Eric Haskins:
Ok I must be doing something wrong on my checkbox validation because its always invalid

Snip of validation:

'agever' => array(
'notEmpty' => array(
   'rule' => array('equalTo', 'yes'),
   'required' => true,
   'message' => 'We require you to be over 13 to register without a Parent.'
)
   ),
   'agreeterms' => array(
'notEmpty' => array(
   'rule' => array('equalTo', 'yes'),
   'required' => true,
   'message' => 'Please Agree to the Terms if you want to proceed.'
)
   ),


part of the form

echo $this->Form->input('agever',array('type'=>'checkbox','value'=>'yes','label' =>'Are you over the age of 13'));
echo $this->Form->input('agreeterms',array('type'=>'checkbox','value'=>'yes','label' => 'I agree to the <a href="/terms" target="_blank">Terms & Conditions</a>'));

What the heck am I doing wrong here. 




--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: