FormHelper::input() automatically adds the error message unless you
tell it not too:

<?php

echo $form->error('User.pass_confirm'); // No conditional needed,
won't display anything if there is no error

echo $form->input('pass_confirm', array(
  'label' => 'Confirm Password',
  'type' => 'password',
  'error' => false
));

?>

On Oct 28, 4:08 pm, thatsgreat2345 <[EMAIL PROTECTED]> wrote:
> I've made  a custom validation for a password field real simple
>
> 'pass_confirm' => array(
>                                                 'samePass' => array('rule' => 
> array('samePass'),
>                                                                               
>           'message' => 'Passwords do not match.'
>                                                                               
>           )
>                                                 ),
>
> function samePass($data) {
>                                         if ( $this->data['User']['password'] 
> == $data['pass_confirm'] )
> {
>                                                 return true;
>                                         } else {
>                                                 return false;
>                                         }
>                                 }
>
> well whenever the passwords do not match it shows the error message
> twice, once before the input and once after the input, this is all I
> have, they both have the same class error-message so I don't know why
> there is 2.
>
>      if ($form->isFieldError('User.pass_confirm')) { 
> e($form->error('User.pass_confirm', null));} e($form-
> >input('pass_confirm',array('label'=>'Confirm
>
> Password:','type'=>'password')) . "<br />\n");
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to