Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After two days I found the right answer follow me step by step:</p> <p><strong>step 1:</strong></p> <p>create <code>PasswordConfirmation.php</code> file in root directory of your project with this path: <code>yourproject/My/Validate/PasswordConfirmation.php</code> with this content below:</p> <pre><code>&lt;?php require_once 'Zend/Validate/Abstract.php'; class My_Validate_PasswordConfirmation extends Zend_Validate_Abstract { const NOT_MATCH = 'notMatch'; protected $_messageTemplates = array( self::NOT_MATCH =&gt; 'Password confirmation does not match' ); public function isValid($value, $context = null) { $value = (string) $value; $this-&gt;_setValue($value); if (is_array($context)) { if (isset($context['user_password']) &amp;&amp; ($value == $context['user_password'])) { return true; } } elseif (is_string($context) &amp;&amp; ($value == $context)) { return true; } $this-&gt;_error(self::NOT_MATCH); return false; } } ?&gt; </code></pre> <p><strong>step 2:</strong></p> <p>Add two field in your form like this:</p> <pre><code>//create the form elements user_password $userPassword = $this-&gt;createElement('password', 'user_password'); $userPassword-&gt;setLabel('Password: '); $userPassword-&gt;setRequired('true'); $this-&gt;addElement($userPassword); //create the form elements user_password repeat $userPasswordRepeat = $this-&gt;createElement('password', 'user_password_confirm'); $userPasswordRepeat-&gt;setLabel('Password repeat: '); $userPasswordRepeat-&gt;setRequired('true'); $userPasswordRepeat-&gt;addPrefixPath('My_Validate', 'My/Validate', 'validate'); $userPasswordRepeat-&gt;addValidator('PasswordConfirmation', true, array('user_password')); $this-&gt;addElement($userPasswordRepeat); </code></pre> <p>now enjoy your code</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload