You are here: Re: hitting enter on a form instead of clicking the button « HTML « IT news, forums, messages
Re: hitting enter on a form instead of clicking the button

Posted by Paul Furman on 03/17/07 03:22

Jukka K. Korpela wrote:

> Scripsit Paul Furman:
>
>> 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.

But below you say using the enter key should work, that was the problem,
it doesn't work.


> As usual, you should have constructed a static HTML page that
> demonstrates the problem and posted its URL.
>
>> Crossposted to html & php groups.

I think it was pretty damned simple.


> 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.)

Who knows? Mysterious things happen. I didn't know what the problem was.


>> <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>.

Obviously this is a snippet and there is a <table> structure above this
snippet.


> And why do you say "no enter"? I can submit it by pressing enter if I want.

No, that was the problem, it doesn't pass:
if (isset($_REQUEST["buy"]))
when using the enter key, only when clicking the button.
I should have included the if clause in my OP.


> 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.

What FAQ?


> 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.

Yes, this was the problem.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация