Is, in a form, Enter a submit key?

  • Thread starter Thread starter Peter J. Veger
  • Start date Start date
P

Peter J. Veger

Has entering the Enter key the same effect as clicking a Submit button?
Can this behavior be changed in some way?
 
Peter J. Veger said:
Has entering the Enter key the same effect as clicking a Submit
button? Can this behavior be changed in some way?

Yes.
No, it can't be changed.
Use the Tab key.
 
Frank wrote on Wed, 1 Mar 2006 02:59:31 -0600:
Yes.
No, it can't be changed.
Use the Tab key.

I have to disagree here. It can be intercepted by using client side
scripting. I found a really stupid a week or so ago that popped up a dialog
saying "do not press enter, click on the submit button" every time I pressed
Enter after typing search words in the search field on their form. With it
being a one field form with one button it seems incredibly short sighted to
not allow someone to press Enter ...

Dan
 
I have on my website a long form: (in paper:) two pages, 50 fields, 10 text
areas
Users may use Enter when filling a textarea, but if they use Enter in text
fields the form is submitted.
So in this form, restricting submit to a click on the submit button is *not*
stupid.
The form action is post; is there a way to detect by scripting that the
Enter key is used.

(Because all my 80 forms always have a single, same-named submit button, I
tested the effect of an Enter:
apparently, if a form has one submit button, pressing Enter delivers the
name-value pair of that submit button!)
 
Have you tried replacing the "input type=submit" by an "input type=image"?
the image will do the submit, but only if you click on it.
Without a submit-button the Enter you press will not go anywhere.

E Tolstoj
 
Thank you.
I have used
<input type="button" onclick="submitForm(event);" />
with
function submitForm(anEvent){((anEvent.target) ? anEvent.target :
anEvent.srcElement).form.submit();}
because I did want to add an image.
 
Peter J. Veger said:
Thank you.
I have used
<input type="button" onclick="submitForm(event);" />
with
function submitForm(anEvent){((anEvent.target) ? anEvent.target :
anEvent.srcElement).form.submit();}
because I did want to add an image.
--

Well, if that works, fine for you. It won't work if people have turned
Javascript off though. Not that I believe so many people did that :)

E Tolstoj
 
I forgot to say:

forms are only relevant for members of a sea-sailing club;
the website is largely visible to all guests but a separate part is only
visible to the members
(and they know that they have to allow javascript...for them the website is
rather dynamic).
 
Peter wrote on Wed, 1 Mar 2006 14:10:02 +0100:
I have on my website a long form: (in paper:) two pages, 50 fields, 10
text areas
Users may use Enter when filling a textarea, but if they use Enter in text
fields the form is submitted.
So in this form, restricting submit to a click on the submit button is
*not* stupid.

Indeed, that would be a good reason not to allow Enter.
The form action is post; is there a way to detect by scripting that the
Enter key is used.

There is, because I've seen it done. I can't remember the site, otherwise I
could have pasted the script from it for you.

Dan
 
Back
Top