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 form validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Storm Applied this week in the Other Open Source APIs forum!
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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: form validation