Okay I have a form/table that I build from an array. What I need to do is
create some one the fly math for inverse cells of this table. that is, if
the value of row 1 column 2 is input to be 2, then the value of row 2 column
1 must be .50. So I need to write some javascript that takes the value put
into the field and onblur or whatever writes its its inverse into its
reciprocal cell. The problem is how do I know what the name of the field is
when the field name is dynamically generated?
Ex:
<cfparam name="startrow" default=1>
<cfquery name="test" datasource="test" dbtype="ODBC">
SELECT *
FROM crits
</cfquery>
<CFSET Total_Records=Test.RecordCount>
<!--- Declare the array --->
<CFSET myarray=ArrayNew(2)>
<!--- Populate the array row by row --->
<CFLOOP QUERY="TEST">
<cfloop index="element" from="1" to="#total_records#" step="1">
<cfif currentrow is element>
<CFSET myarray[CurrentRow][element]=1>
<cfelse>
<CFSET myarray[CurrentRow][element]='<input type="text"
name="field#CurrentRow##element#" value=""
onblur="critweight(this.field)">'>
</cfif>
</cfloop>
</CFLOOP>
<form action="crit_test.cfm" name="critform" id="critform">
<table border="2">
<!--- table headers --->
<tr>
<td></td>
<cfloop query="test">
<cfoutput>
<th>#crit#</th>
</cfoutput>
</cfloop>
</tr>
<!--- Now, create a loop to output the array contents --->
<CFLOOP INDEX="Counter" FROM=1 TO="#Total_Records#">
<tr>
<td><cfoutput query="test" maxrows="1"
startrow="#startrow#"><b>#crit#</b></cfoutput></td>
<cfloop index="element" from="1" to="#total_records#" step="1">
<CFOUTPUT>
<td>#MyArray[Counter][element]#</td>
</CFOUTPUT>
</CFLOOP>
</tr>
<cfset startrow = startrow+1>
</CFLOOP>
</form>
</table>
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.