943,733 Members | Top Members by Rank

Ad:
  • ColdFusion Discussion Thread
  • Unsolved
  • Views: 1672
  • ColdFusion RSS
Jun 26th, 2008
0

Get values

Expand Post »
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:
ColdFusion Syntax (Toggle Plain Text)
  1. <cfset myd = "">
  2. <cfloop list="form.mydata" index="i" delimiters=",">
  3. <cfoutput>
  4. <cfset myd = "#i#">
  5. #myd#<br />
  6. </cfoutput>
  7. </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:
ColdFusion Syntax (Toggle Plain Text)
  1. <cfset myd = "">
  2. <cfloop list="form.mydata" index="i" delimiters=",">
  3. <cfoutput>
  4. <cfset myd = "#i#">
  5. </cfoutput>
  6. </cfloop>
  7. <cfoutput>
  8. #myd#<br />
  9. </cfoutput>
Reputation Points: 10
Solved Threads: 0
Light Poster
chicago1985 is offline Offline
36 posts
since Nov 2007
Jun 27th, 2008
0

Re: Get values

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

ColdFusion Syntax (Toggle Plain Text)
  1. <cfset myd = "">
  2. <cfloop list="#form.mydata#" index="i" delimiters=",">
  3. <cfoutput>
  4. <cfset myd = "#i#">
  5. #myd#<br />
  6. </cfoutput>
  7. </cfloop>

Otherwise, it interprets it as a literal value.
Last edited by cmhampton; Jun 27th, 2008 at 7:53 pm.
Reputation Points: 23
Solved Threads: 10
Junior Poster in Training
cmhampton is offline Offline
79 posts
since Feb 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ColdFusion Forum Timeline: Coldfusion Sticky/Stay-Filled forms
Next Thread in ColdFusion Forum Timeline: title tag





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC