I am using iterator to display list in bean with check boxas below

        <s:iterator value="cableHeadends" id="cableHeadendsIter"
status="rowstatus">     
                <tr>
                <td>                                                            
                        <s:property name="cableName" id="cabelName"
value="cableHeadendName" />
                </td>                                           
                <td>
                <input type='checkbox' name='sel' id='sel' value=''>
                </td>
                <td> 
                <s:hidden name="cableHeadendID" id="cableHeadendID" /> 
                </td>
                </tr> 
        </s:iterator>

I want to get the value for the ones which are select one they are submit.
For that I am using the below java script

function showChecked(selItems) 
{
          var thetable = document.getElementById('mktselect');
          var data="";
          var cableid="";
          var theform = document.cableHeadends;
          var tot = theform.elements.length;
          for (i=0; i<tot; i++) 
          {
          if (theform.elements[i].checked) 
                {
                if (data.length != 0) 
                {
                data = data + "\n";
                }
                        data = data + thetable.rows[i+1].cells[0].innerHTML ;
                if (cableid.length != 0) 
                {
                cableid = cableid + "," ;
                }
                cableid = cableid + 
document.cableHeadends.cableHeadendID[i].value;
                        
                }               
        }
        }

This seems to be working correct but checkboxes are randomly checked without
user selecting those value. It also give object null error when the last
value in the list is selected. Could you anyone help me to figure out the
issue.
-- 
View this message in context: 
http://www.nabble.com/Display-the-list-of-values-in-check-box---Interesting-problem-tf4039222.html#a11475627
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to