Re: Re: HTML QuickForm Stumper
| From: | Justin Patrin | Date: | Thu, 23 Mar 2006 20:55:21 +0000 |
| Subject: | Re: Re: HTML QuickForm Stumper | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23422@lists.php.net to get a copy of this message | ||
On 3/23/06, Mark Wiesemann <wiesemann@php.net> wrote:
> James Reinke wrote:
>
> > For example: (what I ultimately need)
> >
> > <INPUT TYPE="RADIO" NAME="PaymentType"
> > VALUE="debitcard"
> >
> > ONCLICK="Show('debitcarddiv');Hide('creditcarddiv');Hide('checkingaccountdiv')"
> > <? if($_SESSION['account']->PayType=="debitcard") {
> > print "CHECKED"; } ?>>Pay by debit card<br />
> >
> > (what I currently have)
> >
> > $form->addElement('radio', 'PaymentType',
> > array('value' => 'creditcard', 'onclick=' =>
> >
> > 'Show(\'creditcarddiv\');Hide(\'debitcarddiv\');Hide(\'checkingaccountdiv\')'));
>
> Something like:
> if ($_SESSION['account']->PayType == 'debitcard') {
> $form->setValue(array('PaymentType' => 'debitcard';
> }
> should do want you want.
> (Don't have time now to test whether this is really the right code, but
> setValue() should be the right way.)
>
setDefaults() is the right way.
$form->setDefaults(array('PaymentType' =>
$_SESSION['account']->PayType));
--
Justin Patrin