I need to break a line of code onto a second line while keeping it as a line of code. I have the following array and when I use the value "Jerry Wrenn Scholarship" as a value in a radio button, when I retrieve the value from the db, it doesn't match the original value in an CFIF statement. When I make it all on on line, the CFIF works fine. How do I do this sort of soft-return?
<cfset fund_ar = listToArray("The Dean's Fund,Health and Society Visiting Professorship, Jerry Wrenn Scholarship,Kinesiology Gift Fund)
In the example above, I've shortened the entries. I need this to make the code manageable.
-- Daniel Kessler
Department of Public and Community Health University of Maryland Suite 2387 Valley Drive College Park, MD 20742-2611 301-405-2545 Phone www.phi.umd.edu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com
Daniel Kessler 21 December 2004 23:14:53 [ permanent link ]
Well, you could break on commas, and always trim().
I do break on commas. I didn't trim though. I thought that was just for spaces. There none. I'll try it.
You could always replace line breaks with spaces.
I use Dreamweaver to code and I'm not sure how I would do that.
You could use an array and assign each row individually.
I have about 120 entries; one of the reasons that I'm splitting it up. I could do 121 lines of code just to make an array, but I prefer not to which is why I use listToArray. I prefer to just be able to do <cfset = {1,2,3,4,5}> to init an array, like in actionscript, but don't believe that works.
You could do this programmatically using listappend().
OK, I looked that up and it seems applicable.
I'm sure there are others I'm not thinking of.
same here.
thanks for the help.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com
Well, you could break on commas, and always trim(). You could always replace line breaks with spaces. You could use an array and assign each row individually. You could do this programmatically using listappend().
I'm sure there are others I'm not thinking of.
HTH.
--Ben
Daniel Kessler wrote:> I need to break a line of code onto a second line while keeping it as > a line of code. I have the following array and when I use the value > "Jerry Wrenn Scholarship" as a value in a radio button, when I > retrieve the value from the db, it doesn't match the original value > in an CFIF statement. When I make it all on on line, the CFIF works > fine. How do I do this sort of soft-return?>
<cfset fund_ar = listToArray("The Dean's Fund,Health and Society > Visiting Professorship,> Jerry Wrenn Scholarship,Kinesiology Gift Fund)>
In the example above, I've shortened the entries. I need this to > make the code manageable.>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com
Ryan Duckworth 22 December 2004 00:07:25 [ permanent link ]
Can't you just set the array up like this?
<cfset fund_ar = ArrayNew(1)>
<cfset fund_ar[1] = "The Dean's Fund"> <cfset fund_ar[2] = "Health and Society Visiting Professorship"> <cfset fund_ar[3] = "Jerry Wrenn Scholarship"> <cfset fund_ar[4] = "Kinesiology Gift Fund">
You also could use a key, value pair... such as just putting "1" in the radio button then using a lookup for the array. Passing the whole string from the radio button does not seem necessary or practical in this instance. Good luck!
Ryan Duckworth Macromedia ColdFusion Certified Professional
Uhlig Communications 10983 Granada Lane Overland Park, KS 66211 (913) 754-4272
-----Original Message----- From: Daniel Kessler [mailto:danielk-e45ueOrobK4@public.gmane.org] Sent: Tuesday, December 21, 2004 2:57 PM To: CF-Talk Subject: breaking a line of code to two lines
I need to break a line of code onto a second line while keeping it as a line of code. I have the following array and when I use the value "Jerry Wrenn Scholarship" as a value in a radio button, when I retrieve the value from the db, it doesn't match the original value in an CFIF statement. When I make it all on on line, the CFIF works fine. How do I do this sort of soft-return?
<cfset fund_ar = listToArray("The Dean's Fund,Health and Society Visiting Professorship, Jerry Wrenn Scholarship,Kinesiology Gift Fund)
In the example above, I've shortened the entries. I need this to make the code manageable.
-- Daniel Kessler
Department of Public and Community Health University of Maryland Suite 2387 Valley Drive College Park, MD 20742-2611 301-405-2545 Phone www.phi.umd.edu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com
Well, you could break on commas, and always trim().> I do break on commas. I didn't trim though. I thought that was> just for spaces. There none. I'll try it.
Ah, it must have been the wrap monster, then. Trim() removes all whitespace from the beginning and end of the string.
You could always replace line breaks with spaces.> I use Dreamweaver to code and I'm not sure how I would do that.
I meant that you could do it programatically to the data on output (or whatever). That is, you could use replace() to turn the hard returns into spaces.
You could use an array and assign each row individually.> I have about 120 entries; one of the reasons that I'm splitting it> up. I could do 121 lines of code just to make an array, but I prefer> not to which is why I use listToArray. I prefer to just be able to> do <cfset = {1,2,3,4,5}> to init an array, like in actionscript, but> don't believe that works.>
You could do this programmatically using listappend().>
OK, I looked that up and it seems applicable.
If you are turning the list into an array, then using listappend() and appending each line to the list will require as many lines of code as the array declaration. If the reason you prefer listappend() to the array stuff is the possibility of having to renumber, then you can always use arrayappend().
--Ben
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com
Daniel Kessler 22 December 2004 13:50:12 [ permanent link ]
Well, you could break on commas, and always trim().>> I do break on commas. I didn't trim though. I thought that was>> just for spaces. There none. I'll try it.>
Ah, it must have been the wrap monster, then. Trim() removes all >whitespace from the beginning and end of the string.
That's it; it's working now. It seems odd to trim something that's not user entered, but here I am.
If you are turning the list into an array, then using listappend() and >appending each line to the list will require as many lines of code as >the array declaration.
I thought listAppend() would take another list of several entries and then I could do 5 appends for 5 lines each line with several entries, but it doesn't appear to work that way.
thanks for the help.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com
Carlos Balacuit 22 December 2004 21:28:20 [ permanent link ]
You could try:
<cfset fund_ar = listToArray( "The Dean's Fund," & "Health and Society," & "Visiting Professorship," & "Jerry Wrenn Scholarship," & "Kinesiology Gift Fund", ",") />
-- Carlos Balacuit Macromedia Certified ColdFusion MX Advanced Developer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com