Saturday, December 11, 2010

How to achieve Email Validation - with 2 different messages

In email validation - tutorial IBM build a quick web: if it is left
blank, the message displays "enter a valid email".

How to make it so it displays "this field cannot be left blank" ?

Only when something not-email entered in it so does it display "enter
a valid email" ...

I see we at least need to create 2 validation for email field ? the
below is what is being used at the moment:

class User extends AppModel
{
var $name = 'User';

var $validate = array (
'username' => array ('rule' => '/^.{6,40}$/'),
'password' => array('rule'=>'/^.{6,40}$/'),
'email' => array('rule'=> array('email', true),
'message' => 'Enter a valid email')

);

}

Any help with this ?

Thanks !

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate