Skip to main content
Inspiring
January 24, 2013
Question

Is there any way to move to the next row in a cfloop query without restarting the loop?

  • January 24, 2013
  • 1 reply
  • 1029 views

I am attempting to create a table of checkboxes 4 checkboxes wide with about 40 possible query rows to output.

I'd like to <cfnext> my cfloop after outputting each <td> in a row, but I don't see a way to do that.  I haven't even begun to think about how I will read this back in my action form and update the database.  I am considering giving up on it as not possible in ColdFusion.

Any helpful information would be appreciated.

This topic has been closed for replies.

1 reply

Inspiring
January 24, 2013

It sounds like you want to use nested loops.  Something like this:

checkboxes = "f1,f2,f3,f4";

<cfoutput query="yourQuery">

<tr>

<cfloop list="#checkboxes#" index="ThisCheckbox">

<td>

<input type="checkbox" name="checkbox#idFieldInYourQuery#" value = "#yourquery[ThisCheckBox][currentrow]#"> #SomethingElseFromYourQuery#

</td>

</cfloop>

</tr>

</cfoutput>

Inspiring
January 24, 2013

Thanks for the input. I found another solution searching google.  Conditionally closing and opening the table row based on RecordCount MOD 4 EQ 0.

Inspiring
January 24, 2013

Sounds like I misinterpreted your question.

You figured out how to process them yet?