How can I fetch the validation parameters from my models?

Example: I have a field with maxLength set to 20, and I want to
display an error message like "This field can only be 20 characters
long". Now, if I update the validation rule in my model to allow max
30 chars, I need to update my view as well:

In my view:
$form->input('name', array('type' => 'text', 'class' => 'input_text',
'error' => array('required' => 'Name is required', 'length' => 'This
field can only be 20 characters long')))

How can I avoid this? Can I fetch the rule in my view or controller in
some way?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to