This is the code I used to first verify that the two email address fields match and second that the emaill address does not exist in a BD. This is all done in one form.
<cfif isdefined("form.firstname")>
<cfif form.email eq form.emailverify>
<cfquery name="ckDup" datasource="#application.datasource#">
SELECT *
FROM customers
WHERE EMAIL = '#form.email#'
</cfquery>
<cfif ckDup.recordcount EQ 0>
<cfinvoke
component="cfcs.customers" method="insertcustomer">
<cfinvokeargument name="formdata" value="#form#"/>
</cfinvoke>
<cflocation url="index.cfm?thankyou" addtoken="no">
<cfelse>
<cfset errormessage2 = "That Email Already Exists"><div id="errormessage">That Email Already Exists</div>
</cfif>
<cfelse>
<cfset errormessage1 = "Your email addresses did not match"><div id="errormessage">Your email addresses did not match</div>
</cfif>
</cfif>
<cfparam name="form.firstname" default="">
<cfparam name="form.lastname" default="">
<cfparam name="form.email" default="">
<cfparam name="form.primaryphone" default="">
<cfparam name="form.secondaryphone" default="">
<cfparam name="form.address" default="">
<cfparam name="form.city" default="">
<cfparam name="form.state" default="">
<cfparam name="form.postalcode" default="">
<h2>Join our email list</h2>
<div id="DBTable">
<table border="0" cellspacing="0" cellpadding="2" align="center">
<cfform>
<tr>
<td>*First Name:</td>
<td><cfinput type="text" name="firstname" value="#form.firstname#" required="yes" id="firstname" tabindex="1" maxlength="20"></td>
</tr>
<tr>
<td>*Last Name:</td>
<td ><cfinput type="text" name="lastname" value="#form.lastname#" required="yes" id="lastname" tabindex="2" maxlength="20"></td>
</tr>
<tr>
<td>*Email:</td>
<td ><cfinput type="text" name="email" value="#form.email#" validateat="onsubmit" validate="email" required="yes" id="email" tabindex="3" maxlength="50"></td>
</tr>
<tr>
<td>
<cfif isDefined('errormessage1')><div id="errorMessage">*Verify Email:</div>
<cfelse>*Verify Email:</cfif> </td>
<td ><cfinput type="text" name="emailverify" required="yes" id="emailverify" tabindex="4" maxlength="50"></td>
</tr>
<tr>

Start a new topic
Add Reply





MultiQuote
| 


