cfimage - create and use captcha
cfimageCaptchaHowToUse.cfm
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfimage action captcha: how to create and use captcha in coldfusion</title>
</head>
<body>
<h2 style="color:Orangered; font-style:italic">cfimage tag example: how to create and use captcha</h2>
<hr width="550" align="left" color="Orangered" />
<br />
<cfif IsDefined("Form.Submit") and Form.ValidateCaptcha EQ "Captcha">
<h3 style="color:SeaGreen; font-style:italic">
<cfoutput>#Form.Email# successfully subscribe our newsletter.</cfoutput>
</h3>
</cfif>
<table border="1" cellpadding="5" cellspacing="0" bordercolor="Orange">
<tr bgcolor="OrangeRed" style="color:Snow; font-size:large" align="center">
<td colspan="2">
Subscribe our newsletter
</td>
</tr>
<cfform name="NewsletterForm" action="" method="post">
<tr valign="top" style="color:RosyBrown; font-weight:bold">
<td>
Input Captcha Text
</td>
<td>
<cfimage
action="captcha"
difficulty="medium"
text="Captcha"
/>
<br />
<cfinput
name="ValidateCaptcha"
type="text"
required="yes"
message="Input Captcha Text"
style="background-color:Wheat; color:RosyBrown; height:25px; font-size:large; font-style:italic; font:'Comic Sans MS', cursive"
/>
</td>
</tr>
<tr valign="top" style="color:RosyBrown; font-weight:bold">
<td>
Email
</td>
<td>
<cfinput
name="Email"
type="text"
validate="email"
required="yes"
message="Email required."
style="background-color:Wheat; color:RosyBrown; height:25px; font-size:large; font-style:italic; font:'Comic Sans MS', cursive"
/>
</td>
</tr>
<tr valign="top" style="color:RosyBrown; font-weight:bold">
<td align="right" colspan="2">
<cfinput
type="submit"
name="Submit"
value="Subscribe"
style="height:45px; width:150px; font-size:large; font-style:italic; font-weight:bold; color:OrangeRed;"
>
</td>
</tr>
</cfform>
</table>
</body>
</html>