[thelist] dynamic javascript loop help

Brian Cummiskey Brian at hondaswap.com
Mon Jan 17 09:58:05 CST 2005


I'm working on a disgusting form.  :p

it can be anywhere from 0-100 rows, and 0-27 fields depending on what is 
selected on previous pages.  since i have to do some math on the data 
AFTER the pull, i've decided to do it with JS on the client side 
(controlled IE6 environment.)

Basically, i need to set the value of my display form to the field (the 
"datarow_" vars) of the pull form vars (the "row_" vars)

ycounter and fcount are defined via the asp pull, put into hidden form 
vars and are not the issue.


function initvalues() {

	var theform = document.getElementById("frmdefault");

	for(var a=0; theform.ycounter.value -1; a++)
	{
		for(var f=0; theform.fcount.value; f++)
		{
			theform.datarow_+a+_col_+f+.value = row_+a+_col_+f+.innerHTML;
		}
	}
	
}



the problem here, is that i can't seem to assign the dynmic form field 
value with the counter vars, a and f.  Doesn't seem to like the + for 
concatination.

anyone know what i'm doing wrong?




example html row i need to fill in:

<td><input type="text" name="datarow_0_col_0" value="" /></td>


example html row derrived from asp, and hidden (via css) (this is the 
pre-math field that i need to get from the db, but need to calculate on 
before displaying to the user):

<td id='row_0_col_0'>value here</td>



More information about the thelist mailing list