Solved

CFMail Send Checkbox values through email

Posted on 2004-09-15
6
467 Views
Last Modified: 2013-12-24
Hello,

I have a series of checkboxes.  For example:

<input name="cdEasel" type="checkbox" id="cdEasel" value="Easel">Easel
<input name="cdFlipchart" type="checkbox" id="cdFlipchart" value="Flipchart">Flipchart
<input name="cdLCD" type="checkbox" id="cdLCD" value="LCD Projector">LCD Projector

I am sending email like this:
      <cfmail from=#txtEmail# to="name@biz.com" subject="Room Reservation">
       From: #txtFullName#
       Phone: #txtPhone#
       Email: #txtEmail#
       Name of event: #txtName#
       Date: #sltMonth#/#sltDay#/#sltYear#
       Number of People: #txtNumber#
       Time(s) Room is Needed: #txtTimes#
       Room Configuration: #rbConfig#
                 Equipment Needed: THIS IS WHERE I WOULD LIKE TO LOOP THROUGH THE CHECK BOXES ABOVE.              
      </cfmail>

How can I loop through the series of checkboxes and send the values of those checkboxes via the cfmail?

Thank you.
0
Comment
Question by:rudyflyer
6 Comments
 
LVL 21

Expert Comment

by:pinaldave
ID: 12066280
Hi rudyflyer,
you can not loop inside the CFMAIL. you will have to do it outside...

Regards,
---Pinal
0
 

Author Comment

by:rudyflyer
ID: 12066322
I am very new to CF.  How do I do the loop and then send it via email?

Thank you
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 12066364
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 35

Accepted Solution

by:
mrichmon earned 125 total points
ID: 12067931
It looks like you are not actually "looping"

Try this :

 <cfmail from=#txtEmail# to="name@biz.com" subject="Room Reservation">
      From: #txtFullName#
      Phone: #txtPhone#
      Email: #txtEmail#
      Name of event: #txtName#
      Date: #sltMonth#/#sltDay#/#sltYear#
      Number of People: #txtNumber#
      Time(s) Room is Needed: #txtTimes#
      Room Configuration: #rbConfig#
                 Equipment Needed:
                      <cfif  IsDefined("Form.cdEasel")> Easel</cfif>
                      <cfif  IsDefined("Form.cdFlipchart")> Flipchart</cfif>
                      <cfif  IsDefined("Form.cdLCD")> LCD Projector</cfif>
     </cfmail>

0
 
LVL 5

Expert Comment

by:kkhipple
ID: 12075314
isn't it better practice to have something like this?

<!----basically check and verify FORM element exist and does have a value besides the empty string and then output the FORM element value --->

<CFIF IsDefined("FORM.cdEasel") AND FORM.cdEasel NEQ "">#FORM.cdEasel#</CFIF>
<CFIF IsDefined("FORM.cdFlipchart") AND FORM.cdFlipChart NEQ "">#FORM.cdFlipChart#</CFIF>
<CFIF IsDefined("FORM.cdLCD") AND FORM.cdLCD NEQ "">#FORM.cdLCD#</CFIF>
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 12075554
not necessary at all for checkboxes.

They are either defined if they were checked or not defined it they were not checked.

Now what you could do is :

<cfparam name="Form.cdEasel" type="numeric" default="0">

And it will be 1 if the box was checked and 0 otherwise.

But really you can just check if the variable name is defined and that is good enough.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This video discusses moving either the default database or any database to a new volume.
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: …

744 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

9 Experts available now in Live!

Get 1:1 Help Now