Question
Invalid Nested CFOUTPUT
I am reading from a table that contains a list of country
names, and I am using it as as a dropdown. Here is what I have :
<cfquery datasource="intltransquote" name="getcntry">
SELECT * FROM country
order by cntryname
</cfquery>
<tr>
<td valign=top><font color="red">*</font>Country:</td>
<td><select name="tocntry">
<option selected value="">Scroll down to select country</option>
<cfoutput query="getcntry">
<option value="#getcntry.cntryname#">#getcntry.cntryname#</option>
</cfoutput>
</select>
</td>
</tr>
After I submit the form, I redisplay all the informational. For the dropdown, I display what was originally selected, then want to have the list available again if they want to change it. So the first item in the list should be the selected value and the rest of the list should follow. This is what I have :
<tr>
<td valign=top><font color="red">*</font>Country:</td>
<td><select name="tocntry">
<option selected value="#session.tocntry#">#session.tocntry#"</option>
<cfoutput query="getcntry">
<option value="#getcntry.cntryname#">#getcntry.cntryname#</option>
</cfoutput>
</select>
</td>
</tr>
However, I get an error about invalid nested cfoutput. Here is the error message :
Error Occurred While Processing Request
Invalid tag nesting configuration.
A query driven CFOUTPUT tag is nested inside a CFOUTPUT tag that also has a QUERY= attribute. This is not allowed. Nesting these tags implies that you want to use grouped processing. However, only the top-level tag can specify the query that drives the processing.
How do I correct this ?
<cfquery datasource="intltransquote" name="getcntry">
SELECT * FROM country
order by cntryname
</cfquery>
<tr>
<td valign=top><font color="red">*</font>Country:</td>
<td><select name="tocntry">
<option selected value="">Scroll down to select country</option>
<cfoutput query="getcntry">
<option value="#getcntry.cntryname#">#getcntry.cntryname#</option>
</cfoutput>
</select>
</td>
</tr>
After I submit the form, I redisplay all the informational. For the dropdown, I display what was originally selected, then want to have the list available again if they want to change it. So the first item in the list should be the selected value and the rest of the list should follow. This is what I have :
<tr>
<td valign=top><font color="red">*</font>Country:</td>
<td><select name="tocntry">
<option selected value="#session.tocntry#">#session.tocntry#"</option>
<cfoutput query="getcntry">
<option value="#getcntry.cntryname#">#getcntry.cntryname#</option>
</cfoutput>
</select>
</td>
</tr>
However, I get an error about invalid nested cfoutput. Here is the error message :
Error Occurred While Processing Request
Invalid tag nesting configuration.
A query driven CFOUTPUT tag is nested inside a CFOUTPUT tag that also has a QUERY= attribute. This is not allowed. Nesting these tags implies that you want to use grouped processing. However, only the top-level tag can specify the query that drives the processing.
How do I correct this ?