I'm using CakePHP 1.2.0.6311. I'm having an issue when using multiple
validation rules per field (thanks to http://book.cakephp.org for the
help) where only the first failed rule is displayed in the view.
Example:
CustomModel:
var $validate = array(
'my_field' => array(
'minlength' => array(
'rule' => array('minLength', 4),
'message' => 'Must Be at Least 4 Characters Long'
),
'alphanumeric' => array(
'rule' => 'alphaNumeric',
'message' => 'Must Only Contain Alphanumeric Characters'
);
CustomsController:
function testValidate() {
if(!empty($this->data)) {
$this->User->set($this->data);
$this->User->validates();
}
}
test_validate.ctp:
echo $form->create('Custom', array('controller' => 'customs', 'action'
=> 'testValidate'));
echo $form->input('my_field');
echo $form->create('submit');
If both the minlength and alphanumeric rules fail, only the
minlength's message is displayed. However, the validation works with
one or the other.
So, my first question is, am I doing something wrong or is this not a
feature of CakePHP 1.2.0.6311? Last question is - and this may be
stupid - but how does the model pass the message to the view?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---