Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation JavaScript Form Validation

    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.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,247
    Thanks
    203
    Thanked 2,556 Times in 2,534 Posts
    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.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •