I have a section of code that loops through a query of user information and displays to a page. Within this loop is a couple of text boxes and select boxes. The text display's fine. It is the select boxes that display the value of the last record in the query. I think I have scoped the variables correctly but a snippet of code is below:
<cfloop query="findaddress">
<cfoutput>
<table border="1" align="center">
<tr><td>
<!-- form that preloads with address information -->
<form action="listupdate.cfm?#URLToken#&action=updateaddress" name="form#findaddress.currentrow#" method="post">
<input type="Hidden" name="addressid" value="#findaddress.addressid#">
<input type="Hidden" name="mainid" value="#URL.mainid#">
<table align="center" border="0">
<tr>
<td align="center">Type<BR>
<SELECT name="descaddid" size="1">
<cfloop query="finddesc">
<option value=#finddesc.descaddid# <cfif #findaddress.descaddid# EQ #finddesc.descaddid#>SELECTED</cfif>>
#finddesc.descadd#</option>
</cfloop>
</select>
</td>
<td align="center" colspan="2">Address<br><input type="Text" name="address1" value="#address1#"> </td>
<td align="center">C/O<BR><input type="Text" name="co" value="#co#" </td>
</tr>
<tr>
<td>City<BR>
<SELECT name="cityid" size="1">
<cfloop query="findcity">
<option value="#findcity.cityid#" <cfif #findcity.cityid# EQ #findaddress.cityid#>SELECTED</cfif>>
#findcity.city#</option>
</cfloop>
</select>
</td>
This code was designed to create a form for each record that when submitted it will update the information in that record.
I am also having a secondary problem. When I update or add (not shown) with this form, I use a cflocation after the update to send the user back to the original display page to view the changes. Problem is even though the query is being rerun, I have to refresh the page to see the results.
<cfloop query="findaddress">
<cfoutput>
<table border="1" align="center">
<tr><td>
<!-- form that preloads with address information -->
<form action="listupdate.cfm?#URLToken#&action=updateaddress" name="form#findaddress.currentrow#" method="post">
<input type="Hidden" name="addressid" value="#findaddress.addressid#">
<input type="Hidden" name="mainid" value="#URL.mainid#">
<table align="center" border="0">
<tr>
<td align="center">Type<BR>
<SELECT name="descaddid" size="1">
<cfloop query="finddesc">
<option value=#finddesc.descaddid# <cfif #findaddress.descaddid# EQ #finddesc.descaddid#>SELECTED</cfif>>
#finddesc.descadd#</option>
</cfloop>
</select>
</td>
<td align="center" colspan="2">Address<br><input type="Text" name="address1" value="#address1#"> </td>
<td align="center">C/O<BR><input type="Text" name="co" value="#co#" </td>
</tr>
<tr>
<td>City<BR>
<SELECT name="cityid" size="1">
<cfloop query="findcity">
<option value="#findcity.cityid#" <cfif #findcity.cityid# EQ #findaddress.cityid#>SELECTED</cfif>>
#findcity.city#</option>
</cfloop>
</select>
</td>
This code was designed to create a form for each record that when submitted it will update the information in that record.
I am also having a secondary problem. When I update or add (not shown) with this form, I use a cflocation after the update to send the user back to the original display page to view the changes. Problem is even though the query is being rerun, I have to refresh the page to see the results.