Wednesday, January 28, 2009

how to display validation error messages

Hey guys,
Needed help with this one...seems as though it was never answered
anywhere in the group so i think it will help a lot of people-

I have a validation criteria in my Model defined as below:
class District extends AppModel
{

var $validate = array(
'district' => array(
'rule' => 'alphaNumeric',
'message' => 'Error: Empty District Field',
'allowEmpty' => false
)

);

}

Now when the user inputs an empty district field, the save does not
take place as expected. what I would like to do is to somehow print
the 'message' --- 'Error: Empty District Field', that i supplied in
the array above. I was expecting Cake to do it automatically but it
seems iam wrong. Will appreciate any help given.

Thanx again,
Forrestgump
--~--~---------~--~----~------------~-------~--~----~
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: