Addendum - Don't forget that if there's a comma in one of the rows in
the form field e.g. Green eggs, ham  then you would get green eggs as
one list item and ham as another.. Best to remove all commas in the form
field first or replace them with something like a semicolon. So you
would get

"Green eggs; ham,Biscuits,Orange Juice"

<cfset form.myList = replace(form.myList, ",", ";", "All")>
<cfset CommaSeperatedList = replace(form.myList, chr(13), ",", "All")>

:)

Martin

-----Original Message-----
From: Martin Parry [mailto:[EMAIL PROTECTED] 
Sent: 25 November 2004 17:03
To: CF-Talk
Subject: RE: Convert Textarea to List?

<cfset CommaSeperatedList = replace(form.myList, chr(13), ",", "All")>

Just replace form.myList with the correct form field name.

Should work

Martin Parry
Macromedia Certified Developer
http://www.BeetrootStreet.com

-----Original Message-----
From: Bob Haroche [mailto:[EMAIL PROTECTED] 
Sent: 25 November 2004 17:05
To: CF-Talk
Subject: Convert Textarea to List?

My form has a textarea in which a user can input multiple values, one
per
line, eg:

Green eggs and ham
Biscuits
Orange juice

On form submission, the value of form.textarea is a string "Green eggs
and
ham Biscuits Orange juice"

I want to convert the above to a comma delimited list, eg:

"Green eggs and ham, Biscuits, Orange juice"

I've been trying to use REReplace to replace new line returns with
commas -
unsuccessfully. Replacing spaces isn't working either because lines 1
and 3
have spaces in them but should each be considered a single list item.

I know this is done all the time, just not by me.  Advice? Thanks.

-------------
Regards,
Bob Haroche
O n P o i n t  S o l u t i o n s
www.OnPointSolutions.com







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185407
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to