The moose likes HTML, CSS and JavaScript and the fly likes Text field validation on exit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Text field validation on exit" Watch "Text field validation on exit" New topic

Text field validation on exit

Frank Daly
Ranch Hand

Joined: Mar 31, 2000
Posts: 139
Can I validate the contents of a text field on exiting the text field using java Script?
swaroop shastri
Ranch Hand

Joined: Aug 15, 2001
Posts: 65
i remember having used the "onBlur" event for doing this.
<input type="text" value="somevalue" onBlur="return validate();">
Frank Daly
Ranch Hand

Joined: Mar 31, 2000
Posts: 139
Thanks Swaroop
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
You can also use onChange since it will only be invoked when the user leaves the field (assuming the user made a change).

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
subject: Text field validation on exit
Similar Threads
Positioning the cursor in an input field
SchemaExportTask query
inherting classes avalibile i jar
How to disable the right click button in Textfield o HTML form with NN4
JInternalFrame to get Focus