#1
  1. No Profile Picture
    Lourdes
    Guest
    Devshed Newbie (0 - 499 posts)
    In the following code I need to check to see what state was selected from a drop downlist box and then if it's one of the three states in the code I need to set focus to the input text field and not let them exit the field with out making an actual entry. It works like a charm in IE4 but Netscape is totally ignoring my code...If anyone know of any problems that Netscape has with any of the functions specified or if you see an error in my code I'd be so grateful for the feedback. THANKS in advance.
    Here's my code:

    <cfquery name="states" datasource="#Orc_DSN#">
    Select * from r_states
    </cfquery>


    <html>
    <head>
    <title>Untitled</title>
    <Script Language="JavaScript">
    <!--Hide from old browsers

    function stselect(selobj){
    if(selobj=="UT" &#0124; &#0124; selobj=="WY" &#0124; &#0124; selobj=="MT"){
    document.test.years.focus()
    }

    }

    function ageentry(){
    if ((document.test.years.value==null&#0124; &#0124;
    document.test.years.value=="")&&
    (document.test.state.options.value=="UT" &#0124; &#0124; document.test.state.options.value=="WY" &#0124; &#0124;
    document.test.state.options.value=="MT")){
    alert("Age of property is required")
    document.test.years.focus()
    return false;
    }else
    return true;
    }



    //Stop hiding-->


    </script>

    </head>

    <body>
    <form name="test" action="whereever.cfm" method="post">
    <p><font face="Arial" size="-1">2.&nbsp In which state is the property? &nbsp &nbsp
    <select name="state" size="1" onblur="return stselect(this.value)">

    <option>
    <cfoutput query="states">
    <option value="#state_code#" >#State#</option>
    </cfoutput>
    </select>
    <br>
    <br>
    Age of property:<input type="text" name="years" size=15 onblur="return ageentry(this)">
    <br>
    <input type="submit" value="Submit">
    </form>
    </body>
    </html>

  2. #2
  3. No Profile Picture
    guttorm
    Guest
    Devshed Newbie (0 - 499 posts)
    For form validation it is better to to make a form-verification function that returns true if there are no errors, and returns false if there are any (as well as alerting the user about the mistake). For a parameter to the function you can use form itself.


    Then just put this function in your <FORM> tag, like:
    <FORM action=... method=... onSubmit="return verify(this);">

Similar Threads

  1. Form text box validation in Netscape 4.74
    By eaamj01 in forum HTML Programming
    Replies: 5
    Last Post: March 22nd, 2002, 04:17 AM
  2. Netscape 6 not working
    By hazze in forum HTML Programming
    Replies: 1
    Last Post: March 20th, 2002, 09:18 AM
  3. Working in IE and not In Netscape 6.
    By Arus in forum HTML Programming
    Replies: 2
    Last Post: February 5th, 2001, 01:19 PM
  4. SPAN width not working on Netscape 4.x WHY??
    By reman in forum HTML Programming
    Replies: 0
    Last Post: February 2nd, 2001, 07:03 AM
  5. onclick in Netscape not working
    By explore in forum HTML Programming
    Replies: 3
    Last Post: January 22nd, 2001, 10:29 PM

IMN logo majestic logo threadwatch logo seochat tools logo