This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes form 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 "form validation" Watch "form validation" New topic

form validation

Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 361
hi folks,
i am trying to build a form where there are lot of components. my requirement is to validate each component in the form, when user loses focus.

I found some validation code on site, but it works only when the form is submitted.

Can someone tell me if i can find code on net, which would help me do validations for all the components while losing focus.

thnx in advance.

N Chaurasia

SCJP 1.4, SCWCD1.4, OCA(1Z0-007)
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
You need to add validation to every element than.


Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 361
Hi Eric,
i have defined textbox1, textbox2. onblur of textbox1 i call alphabetsValidation and onblur of textbox2 i call numbersValidation. In alphabetsValidation i check if textbox1 lenght is 0, then i set the foucs to textbox1.

In numbersValidation i check if textbox2 lenght is 0, then i set the foucs to textbox2.

Now if i move my cursor from textbox1 to textbox1, then it goes in infinit loop...

what can i do to resolve the problem

thnx in advance
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: form validation
jQuery in Action, 3rd edition