iv********@yahoo.com (ivanhoe) wrote:
All articles and tutorials I've seen on subject of forms say that if
there's name and value for submit button(input tag with
type="submit"), they'll get submitted along with the rest of the
form...
Indeed. But since there is so much bogus info in articles and tutorials
on HTML, this should be checked from the specification.
but I've just noticed (after debugging my perl script for quite a
while :/ ) that it is true only when user clicks on submit, and if
form is submitted via hitting enter you don't get name=value for
submit buttton...
By "hitting enter", you presumably mean pressing the enter (return) key
when focused on a text input field. It is possible to tab to a submit
button and then submit the form by hitting enter, but this is a different
case, and I don't know about similar problems with it (it's effectively
equivalent to clicking on the button, except perhaps for handling
event attributes).
The answer is: Maybe, maybe not. The specifications are vague in this
issue, and browser behavior is close to madness. See
http://ppewww.ph.gla.ac.uk/~flavell/...mquestion.html
Is that supposed to be like that, or I'm doing something wrong?
You should not rely on getting the name=value pair when the form is
submitted by hitting enter in a text input field. And you should not rely
on _not_ getting it. This makes multiple submit buttons a risky affair
(if the form contains text input fields, as it usually does). So it is
better to use a different approach, e.g. letting the user make a choice
by selecting among radio buttons (and using a single submit button)
instead of selecting between different submit buttons.
--
Yucca,
http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring:
http://www.cs.tut.fi/~jkorpela/www.html