Solved

Replace or append items in coldfusioin string

Posted on 2014-04-18
3
239 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
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

679 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