On Tue, 6 Jul 2004 21:19:35 +0200, Torsten Roehr <[EMAIL PROTECTED]> wrote:
> "Justin Patrin" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > On Tue, 6 Jul 2004 18:15:17 +0200, Torsten Roehr <[EMAIL PROTECTED]>
> wrote:
> > > "Richard Davey" <[EMAIL PROTECTED]> wrote in message
> > > news:[EMAIL PROTECTED]
> > > > 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 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--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to