ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old December 11th, 2003, 08:41 AM
infinity003 infinity003 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 100 infinity003 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 53 m 45 sec
Reputation Power: 5
Forms and mailing

Does anyone know how to create a check box that defines whether or not a mail message gets sent. i cant seem to get the cfif statements to work.

heres what i have so far:

<cfoutput>
<cfif contactdirector equal "on">got here
<cfelseif contactdirector is "off">got here2
</cfif>
</cfoutput>

Whenever the checkbox on the form is not checked, the parameter doesnt seem to be sent at all. when it is checked it works.

thanks
greg

Reply With Quote
  #2  
Old December 12th, 2003, 01:51 PM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,480 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 17 h 33 m 17 sec
Reputation Power: 42
That's because when a form checkbox is not checked, there IS NO VARIABLE AT ALL for that field. So what you want it:

<cfif isDefined( 'form.contactDirector' )>
-- code that fires when the box is checked
<cfelse>
-- code that fires when the box is not checked
</cfif>

Reply With Quote
  #3  
Old December 15th, 2003, 11:17 AM
estekguy estekguy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 32 estekguy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Darn checkbox gets ya all the time... I spent a week tracking this one down in another app ... I knew the issue, just forgot cuz it's intuitive to expect it to be there. You're not alone, infinity...

Reply With Quote
  #4  
Old March 10th, 2004, 01:19 AM
anonim anonim is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 2 anonim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy more problems with forms and checkboxes

I am having the same type of problem as infinity2003.

Here is the relevant code that I have in the HTML file:

Code:
<form name="jobForm" action="cfmail.cfm" method="post">
    <input type="checkbox" name="postJob" id="postJob" value="on" />
        <label for="postJob">Post job on our website.</label><br />
    <input type="checkbox" name="sendResumes" id="sendResumes" value="on" />
        <label for="sendResumes">E-mail resumes from our existing database with memo.</label><br />
    <input type="checkbox" name="addToMailingList" id="addToMailingList" value="on" />
        <label for="addToMailingList">Add me to the career fair mailing list.</label><br />
    <input type="checkbox" name="isInquiry" id="isInquiry" value="on" />
        <label for="isInquiry">Do not advertise job (inquiry only).</label><br />
</form>


And here is what I have in the cfmail.cfm file:

Code:
<cfmail to = "#form.mailTo#" from = "noReply@domain.com" subject = "Automated Job Submission">
OPTIONS:
<cfif IsDefined("form.postJob")>Post job on our website.</cfif>
<cfif IsDefined("form.sendResumes")>E-mail resumes from our existing database with memo.</cfif>
<cfif IsDefined("form.addToMailingList")>Add me to the career fair mailing list.</cfif>
<cfif IsDefined("form.isInquiry")>Do not advertise job (inquiry only).</cfif>
</cfmail>


There are other items that are on the form (textboxes, select boxes, etc.) that I am able to post from the html file and mail from the cfmail.cfm. The only time that the script executes without an error is if I check all of the checkboxes and then submit the form. If at least one is unchecked, then the ColdFusion error comes up saying that form.[oneofthecheckboxes] cannot be found. Does anyone know how I can fix this? Thank you in advance, sorry if some of this does not make sense, it is late and I am quite tired..

Reply With Quote
  #5  
Old March 10th, 2004, 07:31 PM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,480 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 17 h 33 m 17 sec
Reputation Power: 42
Seems like there must be some other code, because I don't see anything in the code you posted that would throw an error, even if you did not check a form box. Can you post the actual error text and/or post any extra code in the cfmail.cfm page that you did not already post?

Reply With Quote
  #6  
Old March 10th, 2004, 08:26 PM
anonim anonim is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 2 anonim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You are absolutely correct. I was getting an error when I was using #form.checkboxname#. Everything started to work after I replaced these with "form.checkboxname". Thanks for the reply.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Forms and mailing


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway