The “Please choose…” is selected by default. I want the user to be forced to choose one of the four below it.
<select name=”product”>
<option selected>Please choose…</option>
<option>product 01</option>
<option>product 02</option>
<option>product 03</option>
<option>product 04</option>
</select>
The caveat is that I’m already using two onsubmits and an onclick:
onSubmit=”return (Require(this,’Name’) && submitonce(this))”
onclick=”return checkit()”
Here is the js for the them:
[code]
// Check for a valid email address
var testresults
function checkemail(){
var str=document.formCheck.Email.value
var filter=/^([w-]+(?:.[w-]+)*)@((?:[w-]+.)*w[w-]{0,66}).([a-z]{2,6}(?:.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert(“Please input a valid email address.”)
testresults=false
}
return (testresults)
}
function checkit(){
if (document.layers||document.getElementById||document.all)
return checkemail()
else
return true
}
// Check for required fields
function Require(obForm,szFields)
{
var fields = szFields.split(“,”)
var szMissing= new Array();
for (x=0;x<fields.length;x++) {
if (obForm.elements[fields[x]].value.length==0) {
szMissing[szMissing.length]=new String(fields[x]);
}
}
if (szMissing.length) {
alert(“The”+((szMissing.length>1)?”s “:” “)+szMissing.join(“,”)+” field must be completed.”);
return false
}
return true;
}
// Check for multiple submissions
function submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down “submit” and “reset”
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()==”submit”||tempobj.type.toLowerCase()==”reset”)
//disable em
tempobj.disabled=true
}
}
}