Anne,
"document.formname.Interviewers.value" will only return the first selected
option value. You'll need to loop through the selected options and count how
many are selected. Something along the lines of:
function testing(){
var x = 0
for (i=0; i<document.form1.Interviewers.options.length; i++){
if (document.form1.Interviewers.options[i].selected) x++
}
alert(x)
}
-----Original Message-----
From: anne.do@c... [mailto:anne.do@c...]
Sent: Thursday, December 19, 2002 9:34 AM
To: javascript
Subject: [javascript] Help with Select Box Validation
I have a select box with many option values in my form called Interviewers:
Please select at least three interviwers:
<select name="Interviewers" multiple size=4>
<option value="1">Mary Alston
<option value="2">John Doe
etc.......
</select>
I want at least 3 options choosen from the select box before the form will
submit. Since the document.formname.Interviewers.value will equal "1,2,3"
as a string how can I validate it to check that at least 3 interviwers
were selected?