Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6831053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:41:30+00:00 2026-05-26T22:41:30+00:00

I had write the following code in my Zend Form: $newpassword = new Zend_Form_Element_Password(‘newpassword’);

  • 0

I had write the following code in my Zend Form:

    $newpassword = new Zend_Form_Element_Password('newpassword');
    $newpassword->setLabel("Enter your New Password :")
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator(
                     'NotEmpty',
                      TRUE,
                      array('messages' => array(
                              'isEmpty' => 'Please enter new password.'
                                               )
                           )
                     )
               ->addValidator(
                    'Alnum',
                     TRUE,
                     array('messages' => array(
                                 'alnumInvalid' => 'Please enter a valid new password.',
                                 'notAlnum' => 'Please enter a valid new password.',
                                 'alnumStringEmpty' => 'Please enter a valid new password.'
                                              )
                          )
                          )
               ->addValidator('StringLength', false, array(4, 25))
               ->getValidator('StringLength')->setMessage("Should be 4-25 characters long.");


    $retypepassword = new Zend_Form_Element_Password('retypepassword');
    $retypepassword->setLabel("Retype-Password :")
                   ->setRequired(true)
                   ->addFilter('StripTags')
                   ->addFilter('StringTrim')
                   ->addValidator(
                        'NotEmpty',
                        TRUE,
                        array('messages' => array(
                                         'isEmpty' => 'Please enter confirm password.'
                                                 )
                             )
                       )
                    ->addValidator(
                         new Zend_Validate_Identical('newpassword'),
                         TRUE,
                         array('messages' => array(
 'notSame' => 'New password and confirm password are not matching. They must be same.',
 'missingToken' => 'New password and confirm password are not matching. They must be same.'
                                                  )
                                           )
                                  )
              ->addValidator('StringLength', false, array(4, 25))
              ->getValidator('StringLength')->setMessage("Should be 4-25 characters long.");

As you can see that I had override the error messages for Zend_Validate_Identical i.e. for notSame and missignToken, but still the form is showing the default error message i.e. “The two given tokens do not match”

Can anyone please help me.

Thanks In Advance…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:41:31+00:00Added an answer on May 26, 2026 at 10:41 pm

    The $options parameter to Zend_Form_Element::addValidator gets ignored completely if you pass it a validator object (which you’re doing by passing new Zend_Validate_Identical).

    Instead, you want to do something closer to the way you’ve added your other validators:

    $this->addValidator(
        'Identical',
        TRUE,
        array('token' => 'newpassword',
              'messages' => array(
                  'notSame' => 'New password and confirm password are not matching. They must be same.',
                  'missingToken' => 'New password and confirm password are not matching. They must be same.'
              )
        )
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I write the following code: public void Execute() { var stream = new
I've not had to write much batch file code in the past and I'm
I had found a strange output when I write the following lines in very
Till now I had been using following code to ftp file from one location
I had a doubt which is the following: When I use the following code:
I had the following JavaScript code and it worked correctly - var changeImageButton =
In a C# forms project, I can write the following code to get something
I'm trying to write metadata to a pdf file using the following python code:
Recently I had to write an oracle function, and the error ora-06575 popped up
I have experience with OCaml. You had to write a stub for every function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.