Zend_Form password confirmation with .ini config - Can it be done?

Idzevdttu

New Member
I set out writing a ZF (v1.10.3) application and chose to use Zend_Config_Ini to generate my Zend_Form objects. This was all well and good until I had to test for identical password inputs. This is the part that's misbehaving right now:\[code\]elements.password.type = passwordelements.password2.type = passwordelements.password2.options.validators.identical.validator = "Identical"elements.password2.options.validators.identical.options.token = password\[/code\]Instead of comparing the values of these two elements, it compares password2's value against the literal string "password". So any password except "password" gives me the following validation error:\[code\]The token 'password' does not match the given token '*******'\[/code\]Is there a right way to do this? The only example of using Zend_Validate_Identical with Zend_Config_Ini that I found via Google was from a German website, and someone appeared to recommend the exact same "solution" as my failing code above.I know there are plenty of ways to do this in PHP code, but I've committed myself pretty heavily to INI configuration at this point, and I'd rather not abandon it or make an exception unless I absolutely have to.[EDIT] Here is my full newUserForm.ini:\[code\]method = "post"id = "newUserForm"accept-charset = "utf-8"elements.username.type = "text"elements.username.options.label = "Username"elements.username.options.required = trueelements.username.options.validators.alnum = "Alnum"elements.username.options.validators.strlen.validator = "StringLength"elements.username.options.validators.strlen.options.min = "3"elements.username.options.validators.strlen.options.max = "32"elements.email.type = "text"elements.email.options.label = "Email address"elements.email.options.required = trueelements.email.options.validators.email.validator = "EmailAddress"elements.password.type = "password"elements.password.options.label = "Password"elements.password.options.required = trueelements.password.options.validators.strlen.validator = "StringLength"elements.password.options.validators.strlen.options.min = "6"elements.password2.type = "password"elements.password2.options.label = "Password (confirm)"elements.password2.options.required = trueelements.password2.options.validators.identical.validator = "Identical"elements.password2.options.validators.identical.options.token = passwordelements.submit.type = "submit"elements.submit.options.label = "Submit"\[/code\]And here is my controller action:\[code\]public function indexAction(){ $formConfig = new Zend_Config_Ini(APPLICATION_PATH.'/configs/newUserForm.ini'); $newUserForm = new Zend_Form($formConfig); $request = $this->getRequest(); if ($request->isPost()) { if ($newUserForm->isValid($request->getPost())) { // create new user here $this->_helper->redirector('index', 'index'); } } $this->view->newUserForm = $newUserForm;}\[/code\]
 
Top