What you have should work, just change the name to email1, then cut/
paste the whole rule and rename email2 etc.
You could probably write something on the beforeValidates that renames
your variables to "email", validates them, but then you'd have to get
them back to their original variable names (email1 etc) to save in the
DB. I assume you have 3 columns in your database? email1, email2 etc?
On Dec 2, 9:27 am, "vincent.mu...@gmail.com" <vincent.mu...@gmail.com>
wrote:
> Hi there,
> i got a problem with cake, i m using the lastest version.
>
> i got a form with 3 email fields. email1, email2, email3.
> and in my table, i want to record each email.
>
> i tried to make a validation rule for email.
>
> i got :
>
> var $validate = array(
> 'email' => array(
> 'valid' => array(
> 'rule' => 'email',
> 'message' => 'Please enter a valid email address'
> ),
> 'unique' => array(
> 'rule' => 'isUnique',
> 'message' => 'This email address has already been used'
> )
> ));
>
> but it' doesn"t work at all. i think there's a problem with the name
> of my form fields and the validation.
>
> any idea ?
>
> thanks.
--~--~---------~--~----~------------~-------~--~----~
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:
Post a Comment