I am having issues with making sure users select an option from a select
box... here is my code
function checkit(){
if (document.postd ata.phonenumber == ""){
alert("Please enter a Phone Number");
return false;}
if (document.postd ata.request[document.postda ta.request.sele ctedIndex].value
== ""){
alert("Please Select a Request");
return false;}
}
<form name=postdata action=?action= add method=post onsubmit='retur n
checkit()'>
<input type=text name=phonenumbe r>
<select name=request>
<option value=1>Send manual</option>
<option value=2>Duplica te Product</option>
<option value=3>Did not order</option>
</select>
<input type=submit>
</form>
can someone help me figure this out. I believe it is because
document.postda ta.request is undefined until an option is chosen but I don't
know how to fix that.
box... here is my code
function checkit(){
if (document.postd ata.phonenumber == ""){
alert("Please enter a Phone Number");
return false;}
if (document.postd ata.request[document.postda ta.request.sele ctedIndex].value
== ""){
alert("Please Select a Request");
return false;}
}
<form name=postdata action=?action= add method=post onsubmit='retur n
checkit()'>
<input type=text name=phonenumbe r>
<select name=request>
<option value=1>Send manual</option>
<option value=2>Duplica te Product</option>
<option value=3>Did not order</option>
</select>
<input type=submit>
</form>
can someone help me figure this out. I believe it is because
document.postda ta.request is undefined until an option is chosen but I don't
know how to fix that.
Comment