dcsimg
retrieving values from combo box
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Choi_Chandima
Posted On:   Friday, March 11, 2011 01:21 AM

I'm trying to retrieve a selected value from a combo box in a table grid. this table is adding rows dynamically. so i try accessing the node where the combo box is with row index. This code is in a loop where it iterates through number of rows in the table grid. var row_index =2; //data enters from this place onwards. for(var i = 1; i <= dataRows; i++ ){ x =document.getElementById("tbl_srp").rows[row_index].cells[1].childNodes[0].options[document.getElementById("tbl_srp").rows[row_index].cells[1].childNodes[0].selectedIndex].text; row_index++; } 'tbl_srp' is the table id. I'm getting this error document.getElementById   More>>


I'm trying to retrieve a selected value from a combo box in a table grid.
this table is adding rows dynamically. so i try accessing the node where the combo box is with row index.

			
This code is in a loop where it iterates through number of rows in the table grid.

var row_index =2; //data enters from this place onwards.
for(var i = 1; i <= dataRows; i++ ){

x =document.getElementById("tbl_srp").rows[row_index].cells[1].childNodes[0].options[document.getElementById("tbl_srp").rows[row_index].cells[1].childNodes[0].selectedIndex].text;

row_index++;
}

'tbl_srp' is the table id.

I'm getting this error
document.getElementById("tbl_srp").rows[row_index].cells[1].childNodes[0].selectedIndex is undefined

but it works if there is only one row in the table tbl_srp, for multiple rows it doesn't work. please give me some ideas to sort this out.
thanks
   <<Less
About | Sitemap | Contact