?
Solved

Replace or append items in coldfusioin string

Posted on 2014-04-18
3
Medium Priority
?
245 Views
Last Modified: 2014-04-18
I have a form with some checkboxes. When the form is submitted, the items are saved as a string and separated by commas. So if the checkboxes for "bob", "larry" and "greg" were selected the form value is: bob,larry,greg

I need to take each of those values and add "@mycomp.com" and separate them with semi colons (except the last one). So, they would be: bob@mycomp.com; larry@mycomp.com; greg@mycomp.com

I'd also like to create a list with the values after they are set with the @mycomp.com.

Could someone assist?

Thank you.
0
Comment
Question by:earwig75
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 total points
ID: 40009533
Something like ...

<!--- change delimiter from "," to "@mycomp.com;" --->
<cfset newList = arrayToList(listToArray(FORM.theFieldName), "@mycomp.com;")>
<cfif listLen(newList, ";")>
     <!--- append "@mycomp.com" to last element --->
     <cfset newList = newList &"@mycomp.com">
</cfif>
0
 

Author Closing Comment

by:earwig75
ID: 40009564
You're the best.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 40009658
Thanks. Glad I could help :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question