This question already has an answer here:
- Password Confirmation in zend framework 5 answers
So, I got a small problem with Zend Framework 1.12 and I don't know how to solve it:
I got a userform for a rather simple registration. However, I want it to display 2 password fields, one for the password and one for the confirmation. Obviously, I want it to be password fields instead of text fields, so I did the following:
public function init()
{
$this->setName('user');
... few fields which do work fine ...
$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password')
->setRequired(true);
$passwordConfirm = new Zend_Form_Element_Password('password');
$passwordConfirm->setLabel('Confirm password')
->setRequired(true);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$this->addElements(array($id, $username, $prename, $surname, $password, $passwordConfirm, $email, $gender, $submit));
}
However, the form looks like this once it's printed:
When I swap $password
and $passwordConfirm
, the label of $password
is shown. So I assume each passwordfield overwrites the previous one.
How can I display both passwordfields in one form? Or do I really have to build 2 forms for this purpose?
</div>