Re: Quickform and an array of elements in html

From: Date: Tue, 03 Jun 2003 16:58:38 +0000
Subject: Re: Quickform and an array of elements in html
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5762@lists.php.net to get a copy of this message
<mcarter@quantiv.com> wrote : > Hi, > > I'm creating a line of buttons (not grouped) using the code: > > $actions[] = &HTML_QuickForm::createElement('submit', 'action', > 'Submit'); > $actions[] = &HTML_QuickForm::createElement('submit', 'action', > 'Cancel'); > > When I render for form the first time this appears correct. > > <input name="action_button[action]" value="Submit" > type="submit" /> > <input name="action_button[action]" value="Cancel" > type="submit" /> > > However if I submit the form and it then re-displays (due to a validation > error) it all goes wrong and I end up with two buttons identical in the > output html:- > > <input name="action_button[action]" value="Submit" > type="submit" /> > <input name="action_button[action]" value="Submit" > type="submit" /> > > I think this is because the elements 'name' is used as the index in the > array - how am I able to get the buttons to appear as an array but not step > on each others toes? Does the answer lie within the $form->addGroup() > method? But why does it work the first time.....? > > Regards, Try to upgrade to the last release. Bertrand Mansion Mamasam

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