Ok,
I dug around and found out what to name the file and where to save it,
I think. I saved the file as multi_validate.php in app/models/
behaviours/. Is this correct?
I then defined my rules eg:
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')
),
'addNewLocation' => array(
'city' => array('rule' => 'alphanumeric', 'message' =>
'Only
letters and numbers, please try again.'),
'state' => array('rule' => array('minLenght', 6),
'message' =>
'Password must be at least 6 characters long, please try again.')
)
);
I then set which set of rules to use within my method like this:
$this->Admin->setValidation('prop_add');
but the form submits without validating.
Any ideas where I am going wrong?
Thanks.
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 [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
-~----------~----~----~----~------~----~------~--~---