Defining form recipients by CFSWITCH?
I am working with a form that has several check boxes on it. All of the check boxes have the same name so when the form processes I get a response like, check1,check2,check3 etc...
I want to set this up so that depending on what box(es) are checked different e-mail addresses will receive the form data.
I had tried using CFIF statements like with each checkbox individually named.
<cfif #FORM.check01# is "one">
<cfset emailRecip01="one@address.com">
</cfif>
<cfif #FORM.check02# is "two">
<cfset emailRecip02="two@address.com">
</cfif>
<cfif #FORM.check03# is "three">
<cfset emailRecip03="three@address.com">
</cfif>
<cfmail to="#emailRecip01# #emailRecip02# #emailRecip03#"
subject="Form Response"
from="server@address.com"
type="html">
This works fine if there is one address per checkbox, but I have two addresses and 11 check boxes.
Because of this I tried to use a CFSWITCH command and setup the following commands (shortened for this post).
<cfswitch expression="#FORM.checkBox#">
<cfcase value="one;two" delimiterters=";">
<cfset eAddress1="one@address.com">
</cfcase>
<cfcase value="three" delimiters=";">
<cfset eAddress2="two@address.com">
</cfcase>
<cfdefaultcase>
<cfset eAddress1="three@address.com">
<cfset eAddress2="">
</cfdefaultcase>
</cfswitch>
<cfmail to="#eAddress1# #eAddress2#"
subject="Form Response"
from="server@address.com"
type="html">
I am only receiving e-mails at the <cfdefaultcase> address. Why is this not working?
Thanks,
Jeremiah
