Solved

Replace or append items in coldfusioin string

Posted on 2014-04-18
3
234 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now