View Full Version : JavaScript Form Validation

Jan 23rd, 2012, 12:18 PM
Hi Guys,

I have trying to validate my form using JavaScript.

On blur of the a text box I am calling a function in JavaScript which checks if the text box is empty or not....

If the text box is empty it display an appropriate error message.

The issue I am facing is that, for the first time if any user does not enter any value in the text box, the JS function is invoked and an appropriate error message is displayed....

So when the user tried to enter a value in the text box, a drop down list appear from the past forms data.
(The drop down value appear because the user has already filled in the form in the past. Hence the Browser remember the data filed in, and displays it as a drop down list.)

This allows the user to select any values from the drop down list to fill in the box.*

After the user has selected the appropriate value from the drop down and takes its mouse cursor and navigates to another text box in the form, the first error message does not disappear.

The form does not recognize that the value filed has already been filled in the first filed.*

If the user actually types into the field it recognizes that the text box has a filed is filled.

Please may I know how to solve this issue.

Philip M
Jan 23rd, 2012, 12:25 PM
You do not show any code, but as you are populating the form from a cookie, simply by-pass the textbox validation if the cookie has been read.

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.