Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes HTML, CSS and JavaScript and the fly likes Validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Validation" Watch "Validation" New topic
Author

Validation

prakash muthu
Ranch Hand

Joined: Sep 06, 2000
Posts: 75
Dear Pals,
I have two text fields. Both having onblur event. I have some validation code for both field. while pressing the tab from first column, its doing the validation as well as its going to second column. My problem is, if its any error, the control should not go to second column.
TIA
with regards
Prakash
(prakashem@rediffmail.com)

Prakash.M<BR>Bangalore- India<BR>(prakashem@rediffmail.com)
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
What you want to do is that after the user leaves the text box, check that value to make sure it is ok. If it is then you let it go, if not then you have an alert box followed by a focus() method that returns the user back to the original text box. I would also select the text in the text box so they can edit it easily. The code would be:
form.email.focus();
form.email.select();
Where form is a variable of the document.form_name and email is the name of the text box being checked.
Bill
prakash muthu
Ranch Hand

Joined: Sep 06, 2000
Posts: 75
Hi Bill,
What you said is exactly correct. But if it is any error i'm getting alert message and the control is going to second field then only its coming back to first field because of focus() and select().
so the second field onblur method also get activated. that's why i want to control it.
i think now you will have clear idea about the problem.
-Prakash
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Validation
 
Similar Threads
Need Help in to write query using StringBuffer
Accessing Multiple Tables
Confused about the Number datatype
MigLayout and auto resize
component doesnt remeber value