I have created a custom validation rule which is working as required,
but does not pass the error message to $this->validationErrors when it
is triggered.
// Model: validate rules
var $validate = array(
...,
'partner_information' => array(
'rule' => array('__validatePartnerInformation'),
'message' => 'This field cannot be left blank'
)
}
..
// Model: validate method
function __validatePartnerInformation($data) {
return $this->data[$this->name]['nature_id'] == 3 && $this->data
[$this->name]['partner_information'] == '' ? false : true;
}
// View
..
echo debug($this->validationErrors);
echo $form->input('Organisation.name', array('label' => 'Name'));
echo $form->input('Scheme.partner_information');
..
I set debug to 2 when validation fails so I can echo debug($this-
>validationErrors); and whilst leaving the Organisation.name field
blank triggers and displays "this field cannot be blank" my custom
validation on Scheme.partner_information fails validation but does not
show an error message.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---