Re: Re[2]: [PHP] Re: Form Submission

From: Date: Tue, 06 Jul 2004 20:34:08 +0000
Subject: Re: Re[2]: [PHP] Re: Form Submission
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-189821@lists.php.net to get a copy of this message
On Tue, 6 Jul 2004 21:19:35 +0200, Torsten Roehr <roehr@zilleon.com> wrote: > "Justin Patrin" <papercrane@gmail.com> wrote in message > news:432beae04070611552732304f@mail.gmail.com... > > On Tue, 6 Jul 2004 18:15:17 +0200, Torsten Roehr <roehr@zilleon.com> > wrote: > > > "Richard Davey" <rich@launchcode.co.uk> wrote in message > > > news:305260220.20040706164411@launchcode.co.uk... > > > > Hello Jason, > > > > > > > > Tuesday, July 6, 2004, 2:37:08 PM, you wrote: > > > > > > > > JW> It might not be a good idea to rely on the "submit" button to > > > > JW> be > set. > > > Some > > > > JW> browsers do not set/send it if you didn't explicitly click on the > > > "submit" > > > > JW> button. I would use: > > > > > > > > Absolutely. If you hit ENTER to submit a form (rather than click the > > > > button) you often don't get sent the button value. > > > > > > > > Best regards, > > > > > > > > Richard Davey > > > > > > I never had this problem. Usually the first submit button will come into > > > effect when hitting enter. And my question remains: > > > > > > How do you check which button was pressed (read: which action should be > > > performed) when not relying on this? > > > > > > > The button is generally *not* sent by the browser if you hit enter > > instead of submit. This *will* happen, so you have to deal with it. > > > > If you want to knwo what button was pressed, you have to have > > different button names or values and check them. A button is just > > another form element that is submitted. > > I believe you are wrong here. I just checked it in IE5 and Opera 7.23. > Submitting a form by hitting enter IS THE SAME as pressing a submit button > because the form can only be submitted by putting a submit button in action. > What the browser does if you hit enter is submit the button the focus is on > at this moment - so you will always have this value in POST even if you > don't click on the button. > > IE does this: > When the page is loaded the focus is on the first submit button. If you > click anywhere into the form the focus will go away from the button. When > you then hit enter the focus will automatically be put on the first submit > button again and thereby submit the form. > > Opera does this: > When the page is loaded the focus is on the first submit button. If you > click anywhere into the form the focus will go away from the button. When > you then hit enter the form is NOT submitted because Opera does not put the > focus on the first submit button automatically. > > So from my point of view a form cannot be submitted without at least one of > the submit button values ending in POST. > > What do you think? > I have been burned many times by checking for the submit button when the form is submitted. I know for a fact that at least older versions of IE do this. Firefox may. IMHO, it's just not something you should rely upon. Many (*many*) people have old browsers and you can't count on the button being there. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin--

« previous php.general (#189821) next »