ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old December 10th, 2003, 07:14 PM
premzero premzero is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Sydney, AU
Posts: 36 premzero User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 24 m 58 sec
Reputation Power: 5
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.

Reply With Quote
  #2  
Old December 10th, 2003, 07:33 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,626 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 6 m 34 sec
Reputation Power: 53
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)#' )>

Reply With Quote
  #3  
Old December 10th, 2003, 08:28 PM
premzero premzero is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Sydney, AU
Posts: 36 premzero User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 24 m 58 sec
Reputation Power: 5
Yep thanks. That's exactly what I figured as I tried.

Thanks!

Reply With Quote
  #4  
Old December 7th, 2004, 11:06 AM
eastvillage eastvillage is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 3 eastvillage User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Dealing with textarea spaces?

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!

Reply With Quote
  #5  
Old December 7th, 2004, 04:49 PM
premzero premzero is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Sydney, AU
Posts: 36 premzero User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 24 m 58 sec
Reputation Power: 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/

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > textarea to list


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway