I have a select (drop-down-menu) field in a form , and its name looks like this:
<select name="id[1]"> etc.
I'm trying to disallow a particular choice (the default one of "please choose" that I gave a value of 20) but I'm getting a Javasaript error:
"id.1.value is not an object"
The following is my code:
<script LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!-- Hide script from older browsers
function validForm(cart_quantity) {
if (cart_quantity.id[1].value =="20") {
alert("Please choose your item color")
cart_quantity.id[1].focus()
return false
}
return true
}
// End hiding script --></script>
Where did I go wrong?
<select name="id[1]"> etc.
I'm trying to disallow a particular choice (the default one of "please choose" that I gave a value of 20) but I'm getting a Javasaript error:
"id.1.value is not an object"
The following is my code:
<script LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!-- Hide script from older browsers
function validForm(cart_quantity) {
if (cart_quantity.id[1].value =="20") {
alert("Please choose your item color")
cart_quantity.id[1].focus()
return false
}
return true
}
// End hiding script --></script>
Where did I go wrong?