Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem emailing a form when a check box is blank 1

Status
Not open for further replies.

scottew

IS-IT--Management
Mar 6, 2003
492
US
I have a form that sends an email once it is submitted. Below are three check boxes tha I have on the form. The problem that I am having is that if one of these check boxes is blank, I get an error message stating that the "ELEMENT is not defined in FORM".

Code:
<p class="form_text"><strong>Please check all that are appropriate:</strong></p>
<input type="checkbox" name="other1" value="other value1">Other Value1<br />
<input type="checkbox" name="other2" value="other value2">  Other Value2<br />
<input type="checkbox" name="other3" value="other value3">
Other Value3<br />

This is what I have on the page that emails the form

Code:
<cfmail 

from="#form.email#" 
to=""
cc=""
bcc=""
subject=""
server="server">

The following request was sent from the website....

Name    : #form.name#
Address1: #form.address1#
Address2: #form.address2#
City	: #form.city#
State   : #form.state#
Zip Code: #form.zip#
Email   : #form.email#
Phone   : #form.phone#
Other   : #form.other1#
	: #form.other2#
	: #form.other3#
</cfmail>
<cflocation url="thankyou.html">


How can I get the form to send the email if one of the forms is blank?

Thanks in advance.
Scott
 
CFIF NOT IsDefined("FORM.checkbox") OR FORM.checkbox EQ "">
CFSET FORM.checkbox = "something">
</CFIF>

When checkboxes are not checked they are not defined.

Put this where you have your form submission code.

Cheers

Cheers,

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top