RE: [PEAR] Quickform and an array of elements in html

From: Date: Wed, 04 Jun 2003 08:42:56 +0000
Subject: RE: [PEAR] Quickform and an array of elements in html
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5776@lists.php.net to get a copy of this message
> -----Original Message----- > From: Alexey Borzov [mailto:borz_off@cs.msu.su] > > Bertrand Mansion wrote: > > <mcarter@quantiv.com> wrote : > >>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.....? > > Actually this happens because you click the "Submit" button > and the submitted > value (that was not set before) for it becomes "Submit". If > you clicked the > "Cancel" button, then both buttons would read "Cancel" after > form submit. Yes this behaviour is also true with the 'Cancel' button. > Either use different names for different submit buttons or > convince Bertrand > that this behaviour is not good. Hmm, different names would be a pain. I'd like a single name and then I can just check what value the posted variable is set to in order to take the relevant action. > > Try to upgrade to the last release. > > This won't help... We decided that submit buttons *should* > get their value from > submitted values, remember? Maybe we should reconsider? Yeah it did not help using the latest 3.0RC1 beta. :-( Is there reasoning behind the need to get a submit buttons value from the submitted values? Where would this be used in a web application? Regards, Mike C. --- 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 ________________________________________________________________________

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