Solved

CFMail Send Checkbox values through email

Posted on 2004-09-15
6
475 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
Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

920 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

17 Experts available now in Live!

Get 1:1 Help Now