|
Posted by Jorge on 10/20/98 11:29
Hi guys!
I'm getting crazy about the following error working with QuickForm +
FrontBuilder for a sign up form.
As usual, login / passwd are shown in form by FB:
<code>
[......]
$auth = DB_DataObject::factory('auth');
$fb_auth =& DB_DataObject_FormBuilder::create($auth);
$frm_auth =& $fb_auth->getForm();
$auth->postGenerateForm(&$frm_auth,&$fb_auth);
[....]
</code>
I need user retypes password, then I added postGenerateForm() function
within Auth class. I also added preProcessForm() for encrypt passwd and
it works.
<code>
[.....]
function postGenerateForm(&$form,&$fb) {
// FALLA!! Repite dos veces el campo
$form->addElement('password', 'passwordR', 'Retype password',
array('size'=>32, 'maxlenght'=>32));
$form->addRule('passwordR', 'Retype password', 'required');
$form->addRule(array('password', 'passwordR'), 'Password does not
match.', 'compare');
}
function preProcessForm(&$data) {
if(isset($data['password'])) {
if($data['password'] != $this->password) {
$data['password'] = md5($data['password']);
}
}
//igualar id_user(auth) e id_user(users)
}
[....]
</code>
I think this should be work fine but text element passwordR is shown
three times instead two. If postGenerateForm() is not called then only
one password element is shown. Does anybody know why?
Thanks
--
Jorge Gonzalez y Hurtado de Mendoza
jorge.ghm@gmail.com
http://www.la-nevera.com
soon on your screen http://www.webgout.com, check it out
[Back to original message]
|