I have been searching all day for a way to have multiple rules per
field and custom error messages per rule. I have seen lots and lots of
people looking to do this as well, so I want to solicit help from all
of you brighter than me, and provide a reference for others to look to
for how to do this.

1. Multiple rules per field. I have been trying it lots of ways, but
here is the latest. It doesn't work.

    var $validate = array('username' => array('rule' =>
array('between','2','5'),array('alphaNumeric')));

2. How can I provide a custom error message for each rule? I was able
to set the message for each field in the model by doing the following:

    var $validate = array('website' => array('rule' =>
array('url'),'message' => 'Needs to be url'));

Is this the proper way to do this?

The view only has <?php echo $form->input('website');?> for the field
and it shows the error message properly. Of course, I am not sure how
to do this with question 1 above. I will worry about that once I get
number 1 answered and working properly.

One note: I know that there are many ways to do this by over-riding
the model and adding different pieces to the cake core. I am looking
to use the cake core 1.2 functionality which I understand to be
capable of doing this. If not, let me know.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to