OK, I think I worked out what to name the file and where to save it: app/models/behaviours/multi_validate.php. However I can't get it to work. The form submits without validating.
I first set my validation rules in the model eg: var $actsAs = array('MultiValidatable'); /** * Default validation ruleset */ var $validate = array( 'username' => array('rule' => 'alphanumeric', 'message' => 'Only letters and numbers please.'), 'password' => array('rule' => array('minLenght', 6), 'message' => 'Password must be at least 6 characters long.') //'email' => array('rule' => 'email', 'message' => 'Must be a valid email address.'), ); /** * Custom validation rulesets */ var $validationSets = array( 'admin' => array( 'name' => array('rule' => 'alphanumeric'), 'email' => array('rule' => 'email'), 'age' => array('rule' => 'numeric'), ), 'prop_add' => array( 'prop_code' => array('rule' => 'alphanumeric'), 'city' => array('rule' => 'alphanumeric'), 'prop_page_title' => array('rule' => 'alphanumeric'), 'prop_page_desc' => array('rule' => 'alphanumeric'), 'prop_title' => array('rule' => 'alphanumeric'), 'prop_location' => array('rule' => 'alphanumeric'), 'prop_description' => array('rule' => 'alphanumeric'), 'prop_features' => array('rule' => 'alphanumeric'), 'prop_reviews' => array('rule' => 'alphanumeric'), 'prop_availability' => array('rule' => 'alphanumeric'), 'prop_flickr' => array('rule' => 'alphanumeric') ), I then call the method within my method prop_add() in the controller like this: $this->Admin->setValidation('prop_add'); Any ideas? On Jun 17, 11:06 am, koala kid <[EMAIL PROTECTED]> wrote: > Hi, > > thanks for your help, its really appreciated. I'm new to cake and > although I know its going to be beneficial in the long run right now > the learning curve sucks and what really makes it worse is the lack of > decent documentation. > > For example the behaviour you gave me the link to seems to do exactly > what I need but it doesn't tell me where to save it and what to call > the file. Can you explain? > > Thanks. > > On Jun 17, 6:03 am, keymaster <[EMAIL PROTECTED]> wrote: > > > > How do I run cake's validation methods on each form separately. At the > > > moment you appear to define your rules in $validate outside of any > > > functions/methods. How do I run it from within a method. > > > Use this behavior: > > >http://bakery.cakephp.org/articles/view/using-many-validation-ruleset... --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---