Re: QF & FB duplicate form element

From: Date: Sun, 16 Oct 2005 17:34:38 +0000
Subject: Re: QF & FB duplicate form element
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21505@lists.php.net to get a copy of this message
On 10/16/05, Jorge <jorge.ghm@gmail.com> wrote: > 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); You don't need to (and shouldn't) call postGenerateForm yourself. FormBuilder calls it for you. > [....] > </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? > > thansks > > -- > 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 > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- Justin Patrin

« previous php.pear.general (#21505) next »