954,152 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Get values

I have form.mydata coming to my action page with comma delimeter value:
adam,joe,ben,steve,jill,andy,david

I want to seperate them and it works inside this loop:

<cfset myd = "">
<cfloop list="form.mydata" index="i" delimiters=",">
  <cfoutput>
   <cfset myd = "#i#">
   #myd#
 </cfoutput>
</cfloop>


How do I get them to print outside of loop?
This didnt work because it only printed the first value only and not all of them:

<cfset myd = "">
<cfloop list="form.mydata" index="i" delimiters=",">
  <cfoutput>
   <cfset myd = "#i#">
 </cfoutput>
</cfloop>
 <cfoutput>
   #myd#
 </cfoutput>
chicago1985
Light Poster
36 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

When you use a variable in the list element of the CFLOOP tag, it must be enclosed in #'s...

<cfset myd = "">
<cfloop list="#form.mydata#" index="i" delimiters=",">
  <cfoutput>
   <cfset myd = "#i#">
   #myd#
 </cfoutput>
</cfloop>


Otherwise, it interprets it as a literal value.

cmhampton
Junior Poster in Training
79 posts since Feb 2008
Reputation Points: 23
Solved Threads: 10
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You