Disable list if option selected
<p>My code is partially working. The list gets disabled but it's not catching that I have selected "product1" and then enables the list. Anything else chosen should disable the list completely. List with ID product. So I guess it's something with my syntax for the option selected, not sure if thats the correct way to write it.</p>

<p><strong>VBScript</strong></p>

<pre class="lang-vb prettyprint-override"><code>'Disables or enables list based on selection
Function enabler()
    For Each opt In document.GetElementByID("customer").Options
        If opt.Selected = "product1" Then
          document.GetElementByID("product").Disabled = False
        Else
          document.GetElementByID("product").Disabled = True
        End If
    Next
End Function
</code></pre>

<p><strong>HTA</strong></p>

<pre class="lang-html prettyprint-override"><code>...
&lt;select size="5" id="product" name="ListboxUserRole" onChange="SaveListboxUserRoleValue"&gt;
    &lt;option value="1" selected="selected"&gt;product1&lt;/option&gt;
    &lt;option value="2"&gt;product2&lt;/option&gt;
    &lt;option value="3"&gt;product3&lt;/option&gt;
...
&lt;select size="5" id="customer" name="ListboxCustomer" onChange="SaveListboxCustomerValue" value="1"&gt;
    &lt;option value="1" selected="selected"&gt;customer1&lt;/option&gt;
    &lt;option value="2"&gt;customer2&lt;/option&gt;
    &lt;option value="3"&gt;customer3&lt;/option&gt;
    &lt;option value="4"&gt;customer4&lt;/option&gt;
...
</code></pre>