Solved

CFMail Send Checkbox values through email

Posted on 2004-09-15
6
482 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 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

10 Experts available now in Live!

Get 1:1 Help Now