Re: multiple from error message with escape = false
Hi Amit, Thanks for your help! Kwun. On Apr 30, 8:00 pm, Amit Badkas amitrb...@gmail.com wrote: Hi, The FormHelper::error() needs second argument in same fashion as you used it in Form::input() method's second argument's 'error' key. i.e., echo $form-error('fieldName', array('rule1 = __('Message 1', true), 'rule2 = __('Message 2', true), ..), array('escape' = false)); Hope this helps Amit http://amitrb.wordpress.com/http://coppermine-gallery.net/http://cheesecake-photoblog.org/http://www.sanisoft.com/blog/author/amitbadkas On Wed, Apr 29, 2009 at 11:55 AM, KoPanda kopa...@gmail.com wrote: 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple from error message with escape = false
Hi, The FormHelper::error() needs second argument in same fashion as you used it in Form::input() method's second argument's 'error' key. i.e., echo $form-error('fieldName', array('rule1 = __('Message 1', true), 'rule2 = __('Message 2', true), ..), array('escape' = false)); Hope this helps Amit http://amitrb.wordpress.com/ http://coppermine-gallery.net/ http://cheesecake-photoblog.org/ http://www.sanisoft.com/blog/author/amitbadkas On Wed, Apr 29, 2009 at 11:55 AM, KoPanda kopa...@gmail.com wrote: 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---