On 10/6/07, stefanb <[EMAIL PROTECTED]> wrote:
> 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?
Well, you can set the message in the model as well. WARNING: this
code is not tested
var $validates = array('foo' => array('rule' => VALID_NOT_EMPTY,
'message' => 'Foo cannot be empty'));
That way, you only change it one place.
Hope that helps.
--
Chris Hartjes
Cake Development Corporation
http://www.cakedevelopment.com
My motto for 2007: "Just build it, damnit!"
@TheKeyboard - http://www.littlehart.net/atthekeyboard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---