Re: Overriding form helper error messages in CakePHP 2.0
Hi Richard, Same here. I'm using 2.2.1. Though the doc said we can do that http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html On Monday, October 24, 2011 9:44:33 PM UTC+7, Richard@Home wrote: Hi all. I have the following $validate in my User model: var $validate = array( 'email'=array( 'required'=array( 'rule'='notEmpty', 'message'='cannot be blank' ), 'email'=array( 'rule'='email', 'message'='must be a valid email address' ), 'unique'=array( 'rule'='isUnique', 'message'='that email is already in use' ) ), 'password'=array( 'required'=array( 'rule'='notEmpty', 'message'='cannot be blank' ), 'length'=array( 'rule'=array('minLength', 6), 'message'='must be at least 6 letters, numbers or symbols' ), 'matches'=array( 'rule'='passwordsMatch', 'message'='passwords do not match' ) ) ); And I'm trying to override the 'unique' email address message in my form with: echo $this-Form-input('User.email', array( 'error'=array( 'unique' = 'That email is already in use. Have you ' . $this-Html- link('forgotten your password', array('action'='forgotten_password')) . '?' ) )); But it's still displaying the default validate message, not the custom one. What am I doing wrong? Thanks in advance. -- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: Overriding form helper error messages in CakePHP 2.0
Shamless bump! On Oct 24, 3:44 pm, Richard@Home richardath...@gmail.com wrote: Hi all. I have the following $validate in my User model: var $validate = array( 'email'=array( 'required'=array( 'rule'='notEmpty', 'message'='cannot be blank' ), 'email'=array( 'rule'='email', 'message'='must be a valid email address' ), 'unique'=array( 'rule'='isUnique', 'message'='that email is already in use' ) ), 'password'=array( 'required'=array( 'rule'='notEmpty', 'message'='cannot be blank' ), 'length'=array( 'rule'=array('minLength', 6), 'message'='must be at least 6 letters, numbers or symbols' ), 'matches'=array( 'rule'='passwordsMatch', 'message'='passwords do not match' ) ) ); And I'm trying to override the 'unique' email address message in my form with: echo $this-Form-input('User.email', array( 'error'=array( 'unique' = 'That email is already in use. Have you ' . $this-Html-link('forgotten your password', array('action'='forgotten_password')) . '?' ) )); But it's still displaying the default validate message, not the custom one. What am I doing wrong? Thanks in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: Overriding form helper error messages in CakePHP 2.0
Just did some testing. It worked for a rule 'notempty' but is ignored for the rule 'unique' (or isUnique). Jeremy Burns Class Outfit http://www.classoutfit.com On 28 Oct 2011, at 16:43, Richard@Home wrote: Shamless bump! On Oct 24, 3:44 pm, Richard@Home richardath...@gmail.com wrote: Hi all. I have the following $validate in my User model: var $validate = array( 'email'=array( 'required'=array( 'rule'='notEmpty', 'message'='cannot be blank' ), 'email'=array( 'rule'='email', 'message'='must be a valid email address' ), 'unique'=array( 'rule'='isUnique', 'message'='that email is already in use' ) ), 'password'=array( 'required'=array( 'rule'='notEmpty', 'message'='cannot be blank' ), 'length'=array( 'rule'=array('minLength', 6), 'message'='must be at least 6 letters, numbers or symbols' ), 'matches'=array( 'rule'='passwordsMatch', 'message'='passwords do not match' ) ) ); And I'm trying to override the 'unique' email address message in my form with: echo $this-Form-input('User.email', array( 'error'=array( 'unique' = 'That email is already in use. Have you ' . $this-Html-link('forgotten your password', array('action'='forgotten_password')) . '?' ) )); But it's still displaying the default validate message, not the custom one. What am I doing wrong? Thanks in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Overriding form helper error messages in CakePHP 2.0
Hi all. I have the following $validate in my User model: var $validate = array( 'email'=array( 'required'=array( 'rule'='notEmpty', 'message'='cannot be blank' ), 'email'=array( 'rule'='email', 'message'='must be a valid email address' ), 'unique'=array( 'rule'='isUnique', 'message'='that email is already in use' ) ), 'password'=array( 'required'=array( 'rule'='notEmpty', 'message'='cannot be blank' ), 'length'=array( 'rule'=array('minLength', 6), 'message'='must be at least 6 letters, numbers or symbols' ), 'matches'=array( 'rule'='passwordsMatch', 'message'='passwords do not match' ) ) ); And I'm trying to override the 'unique' email address message in my form with: echo $this-Form-input('User.email', array( 'error'=array( 'unique' = 'That email is already in use. Have you ' . $this-Html- link('forgotten your password', array('action'='forgotten_password')) . '?' ) )); But it's still displaying the default validate message, not the custom one. What am I doing wrong? Thanks in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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