Quickform and an array of elements in html
| From: | Mike Carter | Date: | Tue, 03 Jun 2003 16:10:35 +0000 |
| Subject: | Quickform and an array of elements in html | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5761@lists.php.net to get a copy of this message | ||
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,
--
Mike Carter [web developer]
tel: 01925 758229 // fax: 01925 758023 // web: www.koa.uk.com
This message is confidential.
Unless you are the named addressee or their delegated representative you may
not use, disclose, or copy the contents of the e-mail. If you are not the
named addressee please notify the sender immediately and delete the material
from your computer. Any views or opinions contained in this e-mail are
solely those of the author unless expressly stated otherwise
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.484 / Virus Database: 282 - Release Date: 5/27/2003
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________