>- see footer for list info -<
Here is an example of how I am using it on a feedback form.
<1-- validate form and captcha text --->
<cfif isdefined('form.sendfeedback')>
<cfset errormsg ="">
<cfset error = false>
<!--- validate the form fields --->
<cfif form.name EQ "">
<cfset errormsg = errormsg &
"<li>You must enter your name</li>">
<cfset error = true>
</cfif>
<cfif NOT isValid('email',form.email)>
<cfset errormsg = errormsg &
"<li>You must enter a valid email address</li>">
<cfset error = true>
</cfif>
<cfif form.captcha EQ "" OR NOT
application.captcha.validateCaptcha(form.HashReference,form.captcha)>
<cfset errormsg = errormsg &
"<li>The captcha code entered was incorrect</li>">
<cfset error = true>
</cfif>
<!--- validate the captcha code --->
<cfif NOT error>
<cfmail to="[EMAIL PROTECTED]"
from="#form.email#" subject="customer feedback" type="html">
The following customer feeback has
been received form the web site.
<p>
<strong>name:</strong>
#form.name#<br>
<strong>email:</strong>
#form.email#<br>
<strong>company:</strong>
#form.company#<br>
<strong>comments:</strong>
#form.comments#<br>
</p>
</cfmail>
<br>
<p class="greentext"
align="center"><strong>Thank you for your feedback</strong></p>
<cfset showform = false>
<cfelse>
<cfoutput><ul
class="alert">#errormsg#</ul></cfoutput>
</cfif>
</cfif>
<cfif showform>
<cfset application.captcha =
CreateObject("component","captcha.captchaService").init(configFile="captcha/
captcha.xml") />
<cfset application.captcha.setup() />
<cfset variables.captcha =
application.captcha.createHashReference()>
<cfoutput>
<form name="form" method="post"
action="index.cfm?action=feedback">
Name:<br>
<input name="name" type="text" id="name"
value="#form.name#">
<br>
Company:<br>
<input name="company" type="text" id="company"
value="#form.company#">
<br>
E-mail:<br>
<input name="email" type="text" id="email"
value="#form.email#">
<br>
Comments:<br>
<textarea name="comments" cols="30" rows="5"
id="comments">#form.comments#</textarea>
<br>
Enter the captcha code displayed on the
below image:<br>
<input name="captcha"
type="text"><br><br>
<cfoutput>
<img
src="captcha/displayCaptcha.cfm?hashReference=#variables.captcha.hash#"/>
<input name="HashReference"
type="hidden" value="#variables.captcha.hash#" />
</cfoutput>
<br><br>
<input name="sendfeedback" type="submit"
id="sendefeedback" value="Send">
</form>
</cfoutput>
</cfif>
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<