Javascript: Validate that each combo box selection is unique
<p>I have five combo boxes.  Each one has a different name, but the possible values for each are the same:  1-5.  I would like to use Javascript to validate two things:</p>

<ol>
<li><p>that each value is selected only once.  For example, if the value of "cboCircle" is "1" then the value of "cboSquiggle" cannot be 1, and so on. </p></li>
<li><p>that each selected value is used (i.e. that 1, 2, 3, 4, and 5 have all been chosen.)</p></li>
</ol>

<p>Essentially, these values are supposed to act as a ranking system for the combo boxes, in a rough sort of way...  </p>

<p>Anyone know how I might be able to accomplish this?</p>

<p>NOTE:  I'm new to JS.  Thanks!  </p>

<pre><code>&lt;head&gt;
&lt;script language="javascript"&gt;
function submitSurvey(recID)
{
    var msg = "";

    if ( (document.form.cboCircle.value=="0") || 

(document.form.cboSquiggle.value=="0") ||
 (document.form.cboRectangle.value=="0") || 
(document.form.cboSquare.value=="0") || 
(document.form.cboTriangle.value=="0") )

    {   
        msg += "Please select a value for each combo box.\n";
    }   

    if (msg == "")
    {
        document.getElementById("txtRecID").value = recID;
        form.action = "post.asp";
        form.submit();
    }
    else
    {
        alert (msg);
    }   
}
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;form name="form" id="form" method="post"&gt;
    &lt;table&gt;
    &lt;table width="99%"&gt;
        &lt;tr&gt;
            &lt;td width="29%" bordercolor="#FFFFFF" bgcolor="#FFFFFF"&gt;
                &lt;p align="center"&gt;&lt;img name="circle" src="../images/circle.jpg" width="158" height="146" alt=""&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td width="35%" bordercolor="#FFFFFF" bgcolor="#FFFFFF"&gt;
                &lt;p align="center"&gt;&lt;img name="squiggle" src="../images/squiggle.jpg" width="204" height="155" alt=""&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td width="36%" bordercolor="#FFFFFF" bgcolor="#FFFFFF"&gt;
                &lt;p align="center"&gt;&lt;img name="rectangle" src="../images/rectangle.jpg" width="216" height="122" alt=""&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td bordercolor="#FFFFFF" bgcolor="#FFFFFF"&gt;
                &lt;p align="center"&gt;
                &lt;select name="cboCircle" id="cboCircle"&gt;
                    &lt;%
                    If RS("shapePrimary") = "Circle" Then   
                    %&gt;
                        &lt;option value="1" selected&gt;1&lt;/option&gt;   
                    &lt;%
                    Else
                    %&gt;
                        &lt;option value="0"&gt;&lt;/option&gt;
                        &lt;option value="1"&gt;1&lt;/option&gt;
                        &lt;option value="2"&gt;2&lt;/option&gt;
                        &lt;option value="3"&gt;3&lt;/option&gt;
                        &lt;option value="4"&gt;4&lt;/option&gt;
                        &lt;option value="5"&gt;5&lt;/option&gt;
                    &lt;%
                    End If          
                    %&gt;
                &lt;/select&gt;
                &lt;/p&gt;
            &lt;/td&gt;   

            &lt;td bordercolor="#FFFFFF" bgcolor="#FFFFFF"&gt;
                &lt;p align="center"&gt;
                &lt;select name="cboSquiggle" id="cboSquiggle"&gt;
                    &lt;%
                    If RS("shapePrimary") = "Squiggle" Then 
                    %&gt;
                        &lt;option value="1" selected&gt;1&lt;/option&gt;   
                    &lt;%
                    Else
                    %&gt;
                        &lt;option value="0"&gt;&lt;/option&gt;
                        &lt;option value="1"&gt;1&lt;/option&gt;
                        &lt;option value="2"&gt;2&lt;/option&gt;
                        &lt;option value="3"&gt;3&lt;/option&gt;
                        &lt;option value="4"&gt;4&lt;/option&gt;
                        &lt;option value="5"&gt;5&lt;/option&gt;
                    &lt;%
                    End If          
                    %&gt;
                &lt;/select&gt;
                &lt;/p&gt;    
            &lt;/td&gt;

            &lt;td bordercolor="#FFFFFF" bgcolor="#FFFFFF"&gt;
                &lt;p align="center"&gt;
                &lt;select name="cboRectangle" id="cboRectangle"&gt;
                    &lt;%
                    If RS("shapePrimary") = "Rectangle" Then    
                    %&gt;
                        &lt;option value="1" selected&gt;1&lt;/option&gt;   
                    &lt;%
                    Else
                    %&gt;
                        &lt;option value="0"&gt;&lt;/option&gt;
                        &lt;option value="1"&gt;1&lt;/option&gt;
                        &lt;option value="2"&gt;2&lt;/option&gt;
                        &lt;option value="3"&gt;3&lt;/option&gt;
                        &lt;option value="4"&gt;4&lt;/option&gt;
                        &lt;option value="5"&gt;5&lt;/option&gt;
                    &lt;%
                    End If          
                    %&gt;
                &lt;/select&gt;
                &lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td bordercolor="#FFFFFF" bgcolor="#FFFFFF"&gt;
                &lt;p align="center"&gt;&lt;img name="square" src="../images/square.jpg" width="141" height="143" alt=""&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td bordercolor="#FFFFFF" bgcolor="#FFFFFF"&gt;
                &lt;p align="center"&gt;&lt;img src="../images/triangle.jpg" alt="" name="triangle" width="226" height="167" id="triangle2"&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td bordercolor="#FFFFFF" bgcolor="#FFFFFF"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td bordercolor="#FFFFFF" bgcolor="#FFFFFF"&gt;
                &lt;p align="center"&gt;
                &lt;select name="cboSquare" id="cboSquare"&gt;
                    &lt;%
                    If RS("shapePrimary") = "Square" Then   
                    %&gt;
                        &lt;option value="1" selected&gt;1&lt;/option&gt;   
                    &lt;%
                    Else
                    %&gt;
                        &lt;option value="0"&gt;&lt;/option&gt;
                        &lt;option value="1"&gt;1&lt;/option&gt;
                        &lt;option value="2"&gt;2&lt;/option&gt;
                        &lt;option value="3"&gt;3&lt;/option&gt;
                        &lt;option value="4"&gt;4&lt;/option&gt;
                        &lt;option value="5"&gt;5&lt;/option&gt;
                    &lt;%
                    End If          
                    %&gt;
                &lt;/select&gt;
                &lt;/p&gt;
            &lt;/td&gt;
            &lt;td bordercolor="#FFFFFF" bgcolor="#FFFFFF"&gt;
                &lt;p align="center"&gt;
                &lt;select name="cboTriangle" id="cboTriangle"&gt;
                    &lt;%
                    If RS("shapePrimary") = "Triangle" Then 
                    %&gt;
                        &lt;option value="1" selected&gt;1&lt;/option&gt;   
                    &lt;%
                    Else
                    %&gt;
                        &lt;option value="0"&gt;&lt;/option&gt;
                        &lt;option value="1"&gt;1&lt;/option&gt;
                        &lt;option value="2"&gt;2&lt;/option&gt;
                        &lt;option value="3"&gt;3&lt;/option&gt;
                        &lt;option value="4"&gt;4&lt;/option&gt;
                        &lt;option value="5"&gt;5&lt;/option&gt;
                    &lt;%
                    End If          
                    %&gt;
                &lt;/select&gt;
                &lt;/p&gt;
            &lt;/td&gt;
            &lt;td bordercolor="#FFFFFF" bgcolor="#FFFFFF"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
    &lt;p&gt;&amp;nbsp;&lt;/p&gt;
    &lt;table width="99%" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" class="WebApps"&gt;

        &lt;tr&gt;
            &lt;td width="100%"&gt;
            &lt;p align="left"&gt;
            &lt;input name="btnSubmit" type="button" class="button" id="btnSubmit" value="Submit Survey" onClick="submitSurvey('&lt;%= RS("recID")%&gt;');"&gt;
            &lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
