Saturday, February 28, 2009

Re: Validate rule: multiple (CookBook -> 4.1.4.17 Multiple)

Well, first of all, your syntax is wrong. If you had read Abrar's
example...

Your code:

var $validate = array(
'Role' => array(
'rule' => array('multiple', array('min' => 1)),
'message' => 'Please select at least one role'
)
);

If you read the book pages (or Abrar's example), you'd see that it
should be the following:

var $validate = array(
'fieldname' => array(
'rulename' => array( // rulename can be anything you choose.
'rule' => 'ruletype', // ruletype should be the rule
you're using, i.e. isUnique, notempty, email, multiple, etc. Use an
array if the rule has options (such as multiple).
'message' => 'errormessage'
)
)
);

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: