Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by pkonstan1
at 2024-11-19 08:08:59
Point:150 Replies:3 POST_ID:828814USER_ID:11719
Topic:
JavaScript;Hypertext Markup Language (HTML);PHP Scripting Language
I have a very simple form that has both a "Submit" and "Cancel" button. (See below)..
It includes some javascript that runs when a person hits the "Submit" button.
But if a person enters the email and then hits the "Enter" key instead, the POST treats it as if the "Cancel" button was hit instead of the "Submit"
What do I need to do so that the default action for hitting the "enter" key is the "Submit" button and not the "Cancel" button.
It includes some javascript that runs when a person hits the "Submit" button.
But if a person enters the email and then hits the "Enter" key instead, the POST treats it as if the "Cancel" button was hit instead of the "Submit"
What do I need to do so that the default action for hitting the "enter" key is the "Submit" button and not the "Cancel" button.
<form class="smallbox" id="reg" method="post" action="myfile.php"> <p><label for="email">Email Address</label><input type="text" id="a_email" name="a_email" size="75" maxlength="75"></p> <p><label for="memb">Member ID</label><input type="text" id="memb" name="memb" size="25" maxlength="25"></p> <input type="hidden" name="action" value="looker"> <p align="center"> <input type="button" name="subButton" value="Submit" class="bt_blue" onclick="doAct('reg', 'new')"> <input type="submit" id="cancel" name="canButton" value="Cancel" class="cancel"> </p></form> 1:2:3:4:5:6:7:8:9:
Author: pkonstan1 replied at 2024-11-19 09:07:56
Nice straight forward solution. Thanks a heap.
Accepted Solution
Expert: MunterMan replied at 2024-11-19 08:21:29
100 points EXCELLENT
The input type for cancel is submit and the input type for submit is button. This should be the other way round
<input type="submit" name="subButton" value="Submit" class="bt_blue" onclick="doAct('reg', 'new')"> <input type="button" id="cancel" name="canButton" value="Cancel" class="cancel"> 1:2:
Assisted Solution
Expert: duncanb7 replied at 2024-11-19 08:15:37
50 points EXCELLENT
Is it type of submit button that should be submit intead of button or your typing mistake ?
Duncan
Duncan
<form class="smallbox" id="reg" method="post" action="myfile.php"> <p><label for="email">Email Address</label><input type="text" id="a_email" name="a_email" size="75" maxlength="75"></p> <p><label for="memb">Member ID</label><input type="text" id="memb" name="memb" size="25" maxlength="25"></p> <input type="hidden" name="action" value="looker"> <p align="center"> <input type="submit" name="subButton" value="Submit" class="bt_blue" onclick="doAct('reg', 'new')"> <input type="button" id="cancel" name="canButton" value="Cancel" class="cancel"> </p></form> 1:2:3:4:5:6:7:8:9: