Get values

Reply

Join Date: Nov 2007
Posts: 34
Reputation: chicago1985 is an unknown quantity at this point 
Solved Threads: 0
chicago1985 chicago1985 is offline Offline
Light Poster

Get values

 
0
  #1
Jun 26th, 2008
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:
  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:
  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>
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 72
Reputation: cmhampton is an unknown quantity at this point 
Solved Threads: 10
cmhampton's Avatar
cmhampton cmhampton is offline Offline
Junior Poster in Training

Re: Get values

 
0
  #2
Jun 27th, 2008
When you use a variable in the list element of the CFLOOP tag, it must be enclosed in #'s...

  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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC