aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes basic doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "basic doubt" Watch "basic doubt" New topic
Author

basic doubt

Nijeesh Balan
Ranch Hand

Joined: Oct 09, 2000
Posts: 116
Hi,
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..
Cheers,
Nijeesh.


Thanks & Regards,<br />Nijeesh.
Charlie Sturman
Ranch Hand

Joined: Apr 04, 2002
Posts: 112
You must return false to stop the form from submitting
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
Hi,
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.
A GPuvathingal
Greenhorn

Joined: May 23, 2002
Posts: 10
Hi Nijeesh,
Try this ....
<script>
function checkEnter(event){
if(event.keyCode==13){
return false;
}
}
</script>
<form>
<input type=text onKeyPress='return checkEnter(event)'>
<input type=submit>
</form>
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.


-
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: basic doubt
 
Similar Threads
Text field with #
help with developing a basic java program and algorithm for a program i am working on
about logic:iterate
accesing document elements not having a form
Values in a text field