Hi, could someone help me out here. Probably really simple but not working.
I am using a javascript validation script on an asp(!!!) page for work. Forgetting the Asp side of things (it works on other pages) when i submit it should ask me to fill out the required fields if not done so.
Its fins on the text fields but the drop down menus just are not "requiring" an entry to be chosen....
Script
Code: Select all
<script>
function checkrequired(which){
var pass=true
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elements[i]
if (tempobj.name.substring(0,8)=="required"){
if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
pass=false
break
}
}
}
}
if (!pass){
alert("One or more of the required fields are not completed. Please complete them, then submit again!")
return false
}
else
return true
}
</script>Code: Select all
<select name="requiredFunctional" accesskey="7" tabindex="7">
<option selected>Select One</option>
<option value="Customer Service">Customer Service</option>
<option value="Finance">Finance</option>
<option value="Human Resources">Human Resources</option>
<option value="Information Technology">Information Technology</option>
<option value="Manufacturing">Manufacturing</option>
<option value="Operations">Operations</option>
<option value="Procurement">Procurement</option>
<option value="R&D">R&D</option>
<option value="Sales">Sales</option>
</select>Any ideas?
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: