Hi, I'm trying to use multiple rules for one field with Cake 1.2, but
I can't seem to make it work so far. Here's my validation code:
var $validate = array(
'id' => array('rule' => 'blank',
'on' => 'create'),
'username' => array('required' => array('rule' => VALID_NOT_EMPTY,
'message' => 'This
field
cannot be empty'),
'alphanumeric' => array('rule' =>
'alphanumeric',
'message' => 'Only alphanumeric allowed'),
'unique' => array('rule' =>
'checkUnique',
'message' =>
'This name is already taken')
),
'password' => array('rule' => array('confirmPassword', 'password'),
'message' => 'Passwords do not match'),
'password_confirm' => array('rule' => 'alphanumeric',
'required' => true,
'allowEmpty' => false,
'message' => 'Please
confirm password'),
'email' => array('rule' => 'email',
'required' => true,
'allowEmpty' => false,
'message' => 'Please enter valid email
address')
);
The problem is that no matter what, it sends the last 'message' of my
list of error. So when field is empty or got non-alphanumeric
characters, I got 'This name is already taken', but even with no
errors I got the same message.
I found this post:
http://groups.google.com/group/cake-php/browse_thread/thread/6ac5b6520c7e39df/2d186f12b16bef3b?lnk=gst&q=validate+multiple+rules#2d186f12b16bef3b
but I 'm not sure what to do with it.
If anyone have an idea, help will be really appreciated.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---