|
Posted by Malcolm Dew-Jones on 11/08/29 11:23
=?ISO-8859-1?Q?Nisse_Engstr=F6m?= (PvovotkNOSPAM@tele2.se) wrote:
: On 5 Aug 2005 15:10:01 -0700,
: bryanhales<bryanhales@gmail.com> wrote:
: > bettina@coaster.ch wrote:
: > > I want to submit a form but without a submit button. That's to say, I
: > > want that by giving a definite code in a field and then press <ENTER>
: > > the form will be submitted.
: > > For Example
: > > <form name="search_form" method="post" action="search.php">
: > > ....
: > > ...
: > > Code: <input type="text" name="code" onKeyPress="if (event.keyCode ==
: > > 13) {document.search_form.submit()};">
: > >
: Strange. A simple
: <input type="text" name="code">
: tends to work for me. Even in IE.
It doesn't work in all browsers. In some browsers you have to have a
submit button.
: > > How can I do it without a submit button?
: Beware, there is no shortage of pages with broken Javascripts
: where forms cannot be submitted *at all*. Not having a submit
: button is *extremely* rude in those cases.
I agree, a form should always have a submit button if you intend it to be
submitted. A plain submit button (i.e. no javascript) will work in 100%
of browsers, and makes it plain to every user how to submit. Having a
submit button does not prevent the user from simply pressing the Enter key
to submit the form in those browsers that do that, so nothing is lost by
having a button.
--
This space not for rent.
Navigation:
[Reply to this message]
|