<form method="POST" name= "form" action="mailer.php" onsubmit="return validate()"> <h6 align="left" class="style3"> Name: <input type="text" name="name" size="20"> Phone: <input type="text" name="phone" size="20"> E-mail: <input type="text" name="email" size="30"><br><br> Address: <input type="text" name="addy" size="80"><br><br> Item 1: <select name="item1"> <option value="blank" selected></option> <optgroup label="Bottled Water"> <option value="5galplastic">Mountain Valley 5 Gallon - Plastic</option> <option value="5galglass">Mountain Valley 5 Gallon - Glass</option> <option value="3gal">Mountain Valley 3 Gallon - Plastic</option> <option value="25gal">Mountain Valley 2.5 Gallon - Glass </option> <option value="8oz">Mountain Valley 8oz Plastic </option> <option value="12oz">Mountain Valley 12oz Plastic</option> <option value="16ozglass">Mountain Valley 16.9 oz Premium Vintage Glass</option> <option value="16ozsport">Mountain Valley 16.9oz Plastic Sports Cap</option> <option value="1litglass">Mountain Valley 1 Liter Premium Vintage Glass</option> <option value="1litsports">Mountain Valley 1 Liter Plastic Sports Cap </option> <option value="15ozplastic">Mountain Valley 1.5 Liter Plastic</option> <option value="5galdiamond">Diamond 5 Gallon Plastic </option> <option value="1galdiamond">Diamond 1 Gallon Plastic </option> <option value="1galdiamonddist">Diamond 1 Gallon Distilled Plastic </option> </optgroup>
I want to check if the value of the drop down box is blank. If it is I want a message that says 'please enter your order' I tried =="" and =blank and what you are about to see ==blank neither works, the name, phone, and addy all validate, but it ignores the statement for the drop down box...here is the code
function validate(){
var temp
if (document.form.name.value=="") {
alert("Please enter your name.")
return false
}
else if (document.form.phone.value=="") {
alert("Please enter your phone number.")
return false
}
else if (document.form.addy.value=="") {
alert("Please enter your address.")
return false
}
else if (document.form.item1.value==blank) {
alert("Please enter your order.")
return false
}
return true
}

New Topic/Question
Reply



MultiQuote






|