Is there any way to validate on a restricted set of rules in the
controller?
For instance, I have an email address which is validated in the model
like this:
var $validate = array(
'email' => array(
'maxlength' => array(
'rule' => array('maxLength',100),
'message' => 'Email address must be 100 characters or
less'
),
'notEmpty' => array(
'rule' => 'notEmpty',
'message' => 'Please enter your email address'
),
'validEmail' => array(
'rule' => array('email', false),
'message' => 'Please enter a valid email address'
),
'unique' => array(
'rule' => array('isUnique', false),
'message' => 'This email address has already been
registered. If you have forgotten your password, you can get a
reminder by clicking on the link on the login page'
)
)
)
At one point I want to validate an email address, but I don't want to
check that it's unique (because I'm not actually saving it, just
checking it's otherwise valid).
So far I have:
if($this->User->validates(array('fieldList' => array('email')))) {
...
}
Is there any way to define which rules I want it to validate against,
or does it have to do all of them? I can't find anything on this in
the validation section of the manual (using v.1.2), so any directions
would be much appreciated.
Thanks.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en