File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Validation" Watch "Validation" New topic


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.
with regards

Prakash.M<BR>Bangalore- India<BR>(
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:;;
Where form is a variable of the document.form_name and email is the name of the text box being checked.
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.
I agree. Here's the link:
subject: Validation
jQuery in Action, 3rd edition