|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
textarea to list
this is what i want to do.
I want to have a textarea where I enter a list of company names, one per line. after submitting the form, I'd want to put each line of the textarea into a cold fusion list and then query my database saying something like: select name from companies where name IN (#mylist#) Please tell me how to go about doing this. |
|
#2
|
|||
|
|||
|
First, why not just let the user enter the list as a list, in the textarea? Like "one, two, three"?
But anyway, you should be able to do this by treating the text in the textarea as a list that is delimited by a carriage return/line feed combination. Then you can just change the delimiter from the carriage return/line feed to a comma.: <cfsavecontent variable="myList"> one two three </cfsavecontent> <cfset myList = listChangeDelims( myList, ',', '#chr(13)##chr(10)#' )> |
|
#3
|
|||
|
|||
|
Yep thanks. That's exactly what I figured as I tried.
Thanks! |
|
#4
|
|||
|
|||
|
So i have a textarea that is 5 cols wide and 20 rows long. Users are to copy and paste a list of numbers from an excel sheet into the textarea.
The column in the excel sheet either has a 5 digit number in it, or blank spaces, so the user will invariably copy & paste numbers with spaces. For the life of me I cannot remove the blank spaces on submit: thenumbers = 12345 54321 98765 This is what the source looks like if you output to an html page: 12345 54321 98765 what I get after turning it into a list: newlist = 12345,,54321,98765 I have tried everything to get rid of that extra space. Well, I don't even know what it is because i can't seem to get rid of it. Heellllp! |
|
#5
|
|||
|
|||
|
eastvillage...
If they are spaces, you might try something like this after you have converted it into a list: Code:
<cfset counter="1"> <cfloop list="#wordlist#" index="i"> <cfif #trim(i)# eq ""> <cfset wordlist = ListDeleteAt(wordlist, counter)> </cfif> <cfset counter = counter + 1> </cfloop> haven't tested it... just a quick reply.. hope it works. Prem
__________________
We can help export your products http://www.GIAgroup.com/ |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > textarea to list |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|