• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Fetch the correspondin row using the checkbox checked value

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
I am displaying the bean values as:

<tr class="<%=styleClass%>" >
<td height="18"> <input type = "checkbox" value=<%=aerNo%>></td>
<td height="18"> <%=aer_no%></td>
<td height="18"> <%=selectVersionNo%></td>
<td height="18"> <%=latestVersionNo%></td>
</tr>


Here all the rows will be created dynamically.

I want to read the corresponding row which are all the checkbox's checked in that time of submit.

In the array checkedValue I have the values of corresponding checked check box values.

var j=0;
for(var i=0;i<document.SelectLatest.elements.length;i++)
{
if(document.SelectLatest.elements[i].type == 'checkbox' && document.SelectLatest.elements[i].checked == true)
{
checkedValue[j] = document.SelectLatest.elements[i].value;
j=j+1;
}
}


alert("checkedValue Length :"+checkedValue.length);
for(var i=0;i<noOfRows;i++)
{
var objCols=objRows[i].getElementsByTagName("td");
var aer_no = objCols.item(1).innerText;
for(var j=0;j<checkedValue.length;j++)
{
var checkedValue_t = checkedValue[j];
alert(checkedValue.item(j)+" "+" aer_no :"+aer_no );
if(checkedValue.item(j)==aer_no)
{
alert("From if.........");
}
}
Even though if I have the matches value in the abouve if condition its not entering in to that if block.
Please give me idea to read this corresponding row.



Eventhough if I try checkedValue[j] I am not getting
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try

objCols[1].innerHTML;

You are missing a lot of the code that I have no clue what certain variables are.

Eric
 
kapildev ganeshan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the reply. Fulle code is:

In html
<tr class="<%=alreadySelectedstyleClass%>">
<td height="18"> <input type = "checkbox" name="check" value='<%=aer_no%>'></td>
<td height="18"> '<%=aer_no%>'</td>
<td height="18"> <%=selectVersionNo%></td>
<td height="18"> <%=latestVersionNo%></td>
</tr>

function fetchValue2()
{
mybody=document.getElementsByTagName("body").item(0);
mytab=document.getElementById("mytable");
var objRows=mytab.getElementsByTagName("tr");
var noOfRows=mytab.getElementsByTagName("tr").length;
var valueToUpdate = "";
var checkedValue = new Array();
var j=0;
for(var i=0;i<document.SelectLatest.elements.length;i++)
{
if(document.SelectLatest.elements[i].type == 'checkbox' && document.SelectLatest.elements[i].checked == true)
{
checkedValue[j] = document.SelectLatest.elements[i].value;
j=j+1;
}
}


for(var i=0;i<noOfRows;i++)
{
var objCols=objRows[i].getElementsByTagName("td");
var aer_no = objCols.item(1).innerText;
for(var j=0;j<checkedValue.length;j++)
{
var checkedValue_t = checkedValue[j];
alert(checkedValue[j]+" "+" aer_no :"+aer_no );
}
}
}


Here how to get the control of check box. Then I can read the entire row.
reply
    Bookmark Topic Watch Topic
  • New Topic