Forums Register Login
basic doubt
I have a form with two text boxes and a submit button. I am checking for some validations in onBlur of the text fields.
Now the problem is.. On invalid data, when i hit enter key the form gets submitted eventhough the error message pops up.
Plz clarify..
You must return false to stop the form from submitting
in IE form sometimes get submited when you hit enter on text field.
If this is what happend in your case, you need to define onSubmit event handler for your form, define some variable, and check it status in onSubmit. Handler for your submit button should set this variable so, that submission will be allowed.
Hi Nijeesh,
Try this ....
function checkEnter(event){
return false;
<input type=text onKeyPress='return checkEnter(event)'>
<input type=submit>
Now the form wil not submit if the user hits on Enter key.....He will have to hit on Submit key to submit the form.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards

This thread has been viewed 1109 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jan 23, 2018 17:05:57.