|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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" | | selobj=="WY" | | selobj=="MT"){ document.test.years.focus() } } function ageentry(){ if ((document.test.years.value==null| | document.test.years.value=="")&& (document.test.state.options.value=="UT" | | document.test.state.options.value=="WY" | | 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.  In which state is the property?     <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
|
|||
|
|||
|
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);"> |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Validation not working in Netscape- Help! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|