SID68
asked on
How to prevent hitting "Enter" from submitting...
Good [insert appropriate time here]!
I have the following problem:
I have to create a dialogue where the users have to enter an ID, a password and then have to chose one of 2 things, like yes or no.
Now, setting it up is easy: 1 textarea, 1 password-thingy on yes and on no button.
But, if you entered your password and hit enter, you always send the thing with "yes" (yes is the first button).
This should not happen. Enter should not be the same as pushing no, either (or neither (?)). So how can I prevent hitting Enter from submitting the form?
Thanks in advance.
I have the following problem:
I have to create a dialogue where the users have to enter an ID, a password and then have to chose one of 2 things, like yes or no.
Now, setting it up is easy: 1 textarea, 1 password-thingy on yes and on no button.
But, if you entered your password and hit enter, you always send the thing with "yes" (yes is the first button).
This should not happen. Enter should not be the same as pushing no, either (or neither (?)). So how can I prevent hitting Enter from submitting the form?
Thanks in advance.
ASKER
Hmm. I forgot to mention an important thing. The whole thing is programmed on an Oracle database, hence I would prefer to the whole thing without Javascript, although it is possible.
SID68,
When a form only has one <INPUT> element, pressing Enter submits the form.
Do you need to use a textarea for the user id?
Change it to an <INPUT type="text" ... >
That will solve your problem, if it is acceptable to change the textarea to an <INPUT>.
otherwise, you'll need to use Javascript.
When a form only has one <INPUT> element, pressing Enter submits the form.
Do you need to use a textarea for the user id?
Change it to an <INPUT type="text" ... >
That will solve your problem, if it is acceptable to change the textarea to an <INPUT>.
otherwise, you'll need to use Javascript.
ASKER
I guess I've been a bit unprecise. Here is the actual example:
<FORM ACTION="[some oracle procedure]" METHOD="POST">
<P>
<TABLE BORDER="0">
<TR>
<TD>UserID</TD>
<TD><INPUT TYPE="TEXT" NAME="UserID" SIZE="25"></TD>
</TR>
<TR>
<TD>Password</TD>
<TD><INPUT TYPE="PASSWORD" NAME="PWD" SIZE="25"></TD>
</TR>
<TR>
<TD><INPUT TYPE="SUBMIT" NAME="v_Submit" VALUE="Come"></TD>
<TD><INPUT TYPE="SUBMIT" NAME="v_Submit" VALUE="Go"></TD>
</TR>
</TABLE>
<BR>
<BR>
</FORM>
I hope this makes the problem clear.
<FORM ACTION="[some oracle procedure]" METHOD="POST">
<P>
<TABLE BORDER="0">
<TR>
<TD>UserID</TD>
<TD><INPUT TYPE="TEXT" NAME="UserID" SIZE="25"></TD>
</TR>
<TR>
<TD>Password</TD>
<TD><INPUT TYPE="PASSWORD" NAME="PWD" SIZE="25"></TD>
</TR>
<TR>
<TD><INPUT TYPE="SUBMIT" NAME="v_Submit" VALUE="Come"></TD>
<TD><INPUT TYPE="SUBMIT" NAME="v_Submit" VALUE="Go"></TD>
</TR>
</TABLE>
<BR>
<BR>
</FORM>
I hope this makes the problem clear.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
obvoiusly... put your oracle reference where I have "a.html"
Brian
Brian
Fixed the -1 problem on this question.
Escrow points corrected.
kb
Community Support Moderator
Experts Exchange
Escrow points corrected.
kb
Community Support Moderator
Experts Exchange
davlun