Tuesday, April 28, 2009

multiple from error message with "escape => false"

i have to do add multiple rules to a from field. the website has i18n
support so that the error message will be displayed in Chinese when
the users view Chinese version of the website. The website is
developed in big5 but not utf-8. I have to set the error message with
"escape=>false" to make display correctly in Chinese. The can't be
done either in the model or $form->input(). I instead call

$form->error('Insurance.tel', __('error message', true),
'escape'=>false);

this works when the field has only one rule. What if the field has
multiple validation rules? Like for "Insurance.tel", I set the rules
like this.

'tel' => array(
'length' => array('rule' => array('between', 8, 8)),
'required' => true,
'rule' => 'numeric'
)

the error message only appears when the tel field is not numeric but
not appear when the length is not equal to 8 characters. Is there a
way that I can do this with $form->error()?

Thanks!

--~--~---------~--~----~------------~-------~--~----~
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: