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.
<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>
Open in new window