Skip to main content
Inspiring
Jan 24, 2013 7:05 PM UTC
Question

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

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 is closed to new replies. Start a new post to keep the conversation going.

3 replies

Inspiring
Jan 24, 2013 8:05 PM UTC

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>

Translate
Inspiring
Jan 24, 2013 8:23 PM UTC

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

Translate
Inspiring
Jan 24, 2013 11:16 PM UTC

Sounds like I misinterpreted your question.

You figured out how to process them yet?

Translate