You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by banurekha <ba...@gmail.com> on 2007/07/07 06:40:18 UTC

Display the list of values in check box - Interesting problem

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org