Re: QuickForm password fields

From: Date: Mon, 17 Jun 2002 16:31:11 +0000
Subject: Re: QuickForm password fields
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-1691@lists.php.net to get a copy of this message
Setting value of a password field must be another method... I added this to your QuickForm example file, without results: $defaultValues['ipwdTest'] = 'passwd'; result: <tr> <td align="right" valign="top"><b>Test Password:</b></td> <td nowrap="nowrap" valign="top" align="left"><input name="ipwdTest" type="password" /></td> </tr> BTW: Thanks for all of your help so far! I am willing to make another example script for dummies like me and post it to a site or for the QuickForm docs. David On Monday, June 17, 2002, at 09:36 AM, Bertrand Mansion wrote:
<bmansion@mamasam.com> wrote :
<david@ddahl.com> wrote :
Well, i looked at both of the setConstants and setDefaults methods... so I put this in my code: $userFormEdit->addElement('text', 'namel', 'Last Name'); $userFormEdit->setConstants(array ('namel' => $row['namel'])); and i tried it like this: $formConstantsEdit = array('namel' => $row['namel']); $userFormEdit->addElement('text', 'namel', 'Last Name'); $userFormEdit->setConstants($formConstantsEdit); both output the form like this: <tr> <td align="right" valign="top"><b>Last Name</b></td> <td nowrap="nowrap" valign="top" align="left"><input name="namel" type="text" /></td> </tr> Can you spell it out for me?
Just set the values before adding the elements. Prepare an array with all the values you need for all the elements you need, then setDefaults or setConstants with this array, then addElement. It is just an habit to have to handle the raw data first.
I forgot to say, for the ones who forgot that quickform is object-oriented like ooh_form, that you can also set a value for an element this way if you prefer: $name = &HTML_QuickForm::createElement('text', 'namel', 'Last Name'); $name->setValue('hello world'); $userForm->addElement($name); Bertrand Mansion Mamasam


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