Skip to main content
May 8, 2006
Answered

Create LIST from CFLOOP

  • May 8, 2006
  • 1 reply
  • 723 views
Hi all: I'm trying to create a list of 'ages' using CFLOOP with user input from 2 form fields - FirstAge & LastAge, filling in the ranges in between. Here is the relevant code:

<cfloop index="i" from="#FirstAge#" to="#LastAge#" step="1"> <!--- user inputs FirstAge & LastAge --->
<cfset age = #i#>
</cfloop>
<cfset ageList = ValueList(age)><!--- This should be a comma separated list from FirstAge to LastAge --->

Any thoughts on how to accomplish this?

    This topic has been closed for replies.
    Correct answer
    Build the list inside the loop, one age at a time. Something like the code below should work.

    1 reply

    Correct answer
    May 8, 2006
    Build the list inside the loop, one age at a time. Something like the code below should work.
    May 8, 2006
    Works like a charm!! Thank you!!