7.3.3.11 $options['error']
Using this key allows you to override the default model error messages and can be used, for example, to set i18n messages. It has a number of suboptions which control the wrapping element, wrapping element class name, and whether HTML in the error message will be escaped.
To disable error message output set the error key to false.
$form->input('Model.field', array('error' => false));
$form->input('Model.field', array('error' => false));
To modify the wrapping element type and its class, use the following format:
$form->input('Model.field', array('error' => array('wrap' => 'span', 'class' => 'bzzz')));
$form->input('Model.field', array('error' => array('wrap' => 'span', 'class' => 'bzzz')));
To prevent HTML being automatically escaped in the error message output, set the escape suboption to false:
$form->input('Model.field', array('error' => array('escape' => false)));
$form->input('Model.field', array('error' => array('escape' => false)));
To override the model error messages use an associate array with the keyname of the validation rule:
$form->input('Model.field', array('error' => array('tooShort' => __('This is not long enough', true) )));
$form->input('Model.field', array('error' => array('tooShort' => __('This is not long enough', true) )));
As seen above you can set the error message for each validation rule you have in your models. In addition you can provide i18n messages for your forms.


























