Webform checkbox value in javascript
<p>I have a checkbox list control on my asp.net web form that I am dynamically populating from an arraylist. In javascript I want to be able to iterate through the values in the list and if a particular value has been selected to display other controls on the page. </p>

<p>My issue is that all the values in the checkbox list are showing up as 'on' instead of the actual value set. How do I get the actual values for each checkbox?</p>

<p>Thanks.</p>

<p>Javascript:</p>

<pre><code>checkBoxs=document.getElementById(CheckboxList);
    var options=checkBoxs.getElementsByTagName('input');       

    for(var i=0;i&lt;options.length;i++)
    {            
        if(options[i].value=="Other")
        {
            if(options[i].checked)
            {
                var  otherPub=document.getElementById('&lt;%=alsOtherPublicity.ClientID%&gt;');
                otherPub.style.display='block';

            }                
        } 

    }
</code></pre>

<p><strong>Edit:</strong> The line that I'm having problems with is if(options[i].value=="Other") as the values showing up in firebug are given as 'on' rather than the values that I set.</p>

<p><strong>Edit 2:</strong> The html that is produces looks like:</p>

<pre><code>&lt;span id="ctl00_ContentPlaceHolderMetadata_Allocation1_alfPublicity" class="ucFieldCBL" onChange="alValidate();" onClick="alPublicity('ctl00_ContentPlaceHolderMetadata_Allocation1_alfPublicity');"&gt;
  &lt;input id="ctl00_ContentPlaceHolderMetadata_Allocation1_alfPublicity_0" type="checkbox" name="ctl00$ContentPlaceHolderMetadata$Allocation1$alfPublicity$0"/&gt;
  &lt;label for="ctl00_ContentPlaceHolderMetadata_Allocation1_alfPublicity_0"&gt;Text1&lt;/label&gt;
  &lt;input id="ctl00_ContentPlaceHolderMetadata_Allocation1_alfPublicity_1" type="checkbox" name="ctl00$ContentPlaceHolderMetadata$Allocation1$alfPublicity$1"/&gt;
  &lt;label for="ctl00_ContentPlaceHolderMetadata_Allocation1_alfPublicity_1"&gt;Text2&lt;/label&gt;
  &lt;input id="ctl00_ContentPlaceHolderMetadata_Allocation1_alfPublicity_2" type="checkbox" name="ctl00$ContentPlaceHolderMetadata$Allocation1$alfPublicity$2"/&gt;
  &lt;label for="ctl00_ContentPlaceHolderMetadata_Allocation1_alfPublicity_2"&gt;Text3&lt;/label&gt;
  &lt;input id="ctl00_ContentPlaceHolderMetadata_Allocation1_alfPublicity_3" type="checkbox" name="ctl00$ContentPlaceHolderMetadata$Allocation1$alfPublicity$3"/&gt;
  &lt;label for="ctl00_ContentPlaceHolderMetadata_Allocation1_alfPublicity_3"&gt;Text4&lt;/label&gt;
  &lt;input id="ctl00_ContentPlaceHolderMetadata_Allocation1_alfPublicity_4" type="checkbox" name="ctl00$ContentPlaceHolderMetadata$Allocation1$alfPublicity$4"/&gt;
  &lt;label for="ctl00_ContentPlaceHolderMetadata_Allocation1_alfPublicity_4"&gt;Text5&lt;/label&gt;
&lt;/span&gt;
</code></pre>

<p>It looks as if the issue stems from the lack of a value attribute available on the asp.net checkbox control as described by <a href="http://www.daveparslow.com/2007/08/assigning-value-to-aspnet-checkbox.html" rel="nofollow" title="Dave Parslow">Dave Parslow</a>. I'm currently trying a workaround by calling a function server side to return the text of the checkbox and using that instead. </p>
