Re: QuickForm w/Smarty: Defaults render when form has error
| From: | Alexey Borzov | Date: | Sat, 03 Jan 2004 23:24:30 +0000 |
| Subject: | Re: QuickForm w/Smarty: Defaults render when form has error | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9939@lists.php.net to get a copy of this message | ||
Hi!
Tim Weichman wrote:
I've got one of those 5-hour head-scratchers: I'm using HTML_QuickForm in combo with HTML_QuickForm_Renderer_ArraySmarty to handle a sign-up form. I'm down to my last element -- a simple two item radio group -- and I'm having quite a bit of trouble with it. I finally have it rendering the way I'd like (when the form first loads), but there's a problem with the default value always rendering as selected when there's an error elsewhere on the form. The end result is that on form error, both items come back selected. Here's a couple code snippets: //Form and Smarty object already created by now setSignUpFormDefaults(); function makeFormElementRadio() {You effectively added two radio buttons with *different* names. I suggest you read some HTML tutorial which describes how radio buttons work.$radio[] = &HTML_QuickForm::createElement('radio', 'yes', 'yesLabel',NULL, '1');$radio[] = &HTML_QuickForm::createElement('radio', 'no', 'noLabel',NULL, '0');$this->form->addGroup($radio, 'radio', '');}