angelacrouch
05-14-2007, 07:37 PM
Hello all! I have an order form with multiple selection boxes. I need the JavaScript to check if one selection has been selected but not another. For example, I have several t-shirts on the page. If a user wants to order a t-shirt, they need to select the color, quantity and size from three different selection boxes. Some of the users are selecting from one or two of the selection boxes but forgetting to select from the other.
Here is what I have for my code:
<script type="text/javascript">
if(document.OrderForm.tshirtname.selectedIndex != 0 || document.OrderForm.tshirtname.selectedIndex != 0 || document.OrderForm.tshirtname.selectedIndex != 0){
//tshirtname is incomplete
alert("You're selection for tshirtname is incomplete. Please ensure that you have entered a color, size, and quantity.");
return false;
}
</script>
I'm pretty new at scripting so please be gentle. This code doesn't work right now.
Here is what I have for my code:
<script type="text/javascript">
if(document.OrderForm.tshirtname.selectedIndex != 0 || document.OrderForm.tshirtname.selectedIndex != 0 || document.OrderForm.tshirtname.selectedIndex != 0){
//tshirtname is incomplete
alert("You're selection for tshirtname is incomplete. Please ensure that you have entered a color, size, and quantity.");
return false;
}
</script>
I'm pretty new at scripting so please be gentle. This code doesn't work right now.