wood burning stoves 2.0*
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
Author

form validation

Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 358
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 http://www.javascript-coder.com/html-form/javascript-form-validation.phtml 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
author
Rancher

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

onblur="ValidateSomeField()"

Eric
Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 358
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: form validation