|
Posted by Jukka K. Korpela on 03/16/07 18:48
Scripsit Paul Furman:
> I'm getting incorrect response when hitting the enter key instead of
> actually clicking the button on a form.
Define "incorrect". The snippet of HTML that you posted is syntactically
malformed. There is no specification that says what should happen then.
> It activates but the post data
> [value='Update'] isn't being sent I think.
It probably isn't. This has been left to browsers, but they generally don't
treat a submit button as "successful" if it isn't used, which is rather
reasonable if you ask me.
> This is php generated, I'm just pasting the page source (reformatted &
> extra junk removed and I think they are now identical), and it's
> running on my localhost apache server for testing so maybe there's
> something funny with my setup.
As usual, you should have constructed a static HTML page that demonstrates
the problem and posted its URL.
> Crossposted to html & php groups.
As usual, crossposting resulted from insufficient thinking. There is really
no reason to suspect that PHP is involved in the submission problem. You
would have seen this if you had constructed the static page. (Followups
trimmed.)
> Must click button (no enter):
Huh?
> <form action='?SC=cart.php' method='POST'>
> <tr>
> <td>
> <input type='hidden' name='item' value='6077'>name
> </td>
> <td>
> <input type='submit' name='buy' value='Update'>
> </td>
> <td>
> <input type='text' name='item_qty' size='1' value='2'>
> </td>
> </tr>
> </form>
This is syntactically malformed: you cannot have a <tr> element as a child
of <form>.
And why do you say "no enter"? I can submit it by pressing enter if I want.
So what is your question? It's probably something closely related to some
questions in the FAQ, which you apparently didn't check before posting.
If you want to have a field always appearing in the form data (why?), then
it should be included as a hidden field _only_, preferably _without_ another
field with the same name in the same form, since it sounds like your form
handler is simplistic and could get confused with that.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
Navigation:
[Reply to this message]
|