QF & FB duplicate element form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx
http://www.la-nevera.com
soon on your screen http://www.webgout.com, check it out

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux