form with one input type TEXT

P

PSA

if a form just has one input tag of the type TEXT and a non-submit
button. Key press enter in the text field will still submit the
request, If add another input type TEXT it will not exhibit this
behavior

any thoughts/poiners why ?

PSA

Following is the javascript code which i tried
<HTML>
<BODY>
<FORM METHOD=POST NAME="Container0" id="Container0" >

<TABLE cellspacing="0" cellpadding="3" border="0" width="580">

<TR>
<TD align="left" valign="middle">
<input type="TEXT" id="TextEntry3" tabindex="3" maxlength="64"
size="20" value="" name="TextEntry3" />
</TD>
</TR>

<TR>
<TD align="left" valign="middle">
<INPUT TYPE=BUTTON NAME="SAVE" VALUE="Save Changes" tabIndex="4"
id="SAVE" />
</TD>
</TR>

</TABLE>
</FORM>
</BODY>
</HTML>
 
E

Evertjan.

PSA wrote on 10 apr 2008 in comp.lang.javascript:
if a form just has one input tag of the type TEXT and a non-submit
button. Key press enter in the text field will still submit the
request, If add another input type TEXT it will not exhibit this
behavior

any thoughts/poiners why ?

PSA

Following is the javascript code which i tried

Where is the Javascript?
<HTML>
<BODY>
<FORM METHOD=POST NAME="Container0" id="Container0" >

<TABLE cellspacing="0" cellpadding="3" border="0" width="580">

Does the table add to your point?
 
J

Joost Diepenmaat

PSA said:
if a form just has one input tag of the type TEXT and a non-submit
button. Key press enter in the text field will still submit the
request, If add another input type TEXT it will not exhibit this
behavior

It will in IE and Firefox, AFAIK.
any thoughts/poiners why ?

This is all from vague memory and conjecture: I guess the behaviour
originated from the behaviour of the ISINDEX element. Internet explorer
expanded the form behaviour at some point to interpret any ENTER press
on an INPUT element to mean submit on the related FORM. Netscape/Mozilla
followed later.

Note that AFAIK none of this behaviour is officially standardized, so
for perfect standards compliant and accessible behaviour you will need a
submit button for *all* forms you use, including forms with only one
INPUT box.
 
P

PSA

oops i didn't mean java script, its just a simple form with input type
and table tag

PSA
 
V

VK

It will in IE and Firefox, AFAIK.


This is all from vague memory and conjecture: I guess the behaviour
originated from the behaviour of the ISINDEX element. Internet explorer
expanded the form behaviour at some point to interpret any ENTER press
on an INPUT element to mean submit on the related FORM. Netscape/Mozilla
followed later.

Note that AFAIK none of this behaviour is officially standardized, so

It is not correct. It is right that the whole history goes back to the
prehistoric ISINDEX, but later it was adopted into HTML 2.0 for
INPUT=TEXT as well. Despite it was marked as "should" and not "must",
all browsers AFAIK supported and supporting it.

http://www.w3.org/MarkUp/html-spec/html-spec_8.html
"When there is only one single-line text input field in a form, the
user agent should accept Enter in that field as a request to submit
the form."
 
E

Evertjan.

PSA wrote on 10 apr 2008 in comp.lang.javascript:
oops i didn't mean java script, its just a simple form with input type
and table tag

[Please do not toppost on usenet]

If so you are off topic in this NG.

btw, it is Javascript, not java script, as it is not scripthed Java.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top