Re: Re: QuickForm w/Smarty: Defaults render when form haserror
| From: | Tim W | Date: | Sun, 04 Jan 2004 00:14:58 +0000 |
| Subject: | Re: Re: QuickForm w/Smarty: Defaults render when form haserror | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9941@lists.php.net to get a copy of this message | ||
>Hi Tim,
>
>Can you confirm your problem with the last release 3.2.1 ?
>
>Bertrand
Hi Bertrand,
I installed the latest QuickForm version after seeing the notice this
morning about there being Smarty and radio group bugs in the old one. The
problem has gotten better, but there's still something strange happening.
First, I should mention that one of the hurdles is that I'm trying to use a
table to split up the presentation of the radio element and the label.
There's several problems (though probably one cause):
1) When there's a form error, the option the user chooses from the radio
group doesn't get displayed -> it only gets displayed if it matches the
default value (which tells me the value probably isn't getting back to the
validator at all).
2) The output of the form doesn't reflect the value for the radio option
selected.
3) Here's the best I've been able to do to get it to render correctly:
<input name="KeyListStatusID[]" value="1" type="radio"
id="qf_862814"
checked="checked" />
See that name array KeyListStatusID[]? --> I can't get that guy to show up
like a standard group name: KeyListStatusID.
Currently here's the best I've been able to come up with for adding the
elements to the form: (I've tried every variation I can come up with):
$radio[] = &HTML_QuickForm::createElement('radio', '', 'Label
message1', '',
'1');
$radio[] = &HTML_QuickForm::createElement('radio', '', 'Label
message2', '',
'3');
$this->form->addGroup($radio, 'KeyListStatusID', '');
Setting the defaults looks like this:
function setSignUpFormDefaults()
{
$this->form->setDefaults(array( 'KeyListStatusID' => '1' ));
}
Last, here's where you can see the form in action and (if you scroll way
down) you can see the renderer array. Plus, on a successful submit you'll
see the values that are being gathered. (feel free to do a successful submit
as it won't be wired to the production DB for another few days).
http://www.guyfinley.com/testing/testFreebie/21WaysPoster/
Can you see what I'm doing wrong?
By the way -- thanks very much for all the help you give to this community,
and the demeanor in which you do it!
Appreciatively,
Tim