HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 6th, 1999, 10:00 AM
Lourdes
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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.&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>


Reply With Quote
  #2  
Old October 1st, 1999, 03:45 AM
guttorm
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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);">


Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Validation not working in Netscape- Help!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway