Well, first of all, you have to ask yourself what it is
exactly you will be validating. Validation for example could be as
simple as making sure at least one character is entered, or it
could be as complicated as checking if an email address entered is
valid.
Sometimes, you might have several different types of
validation even on the same field...for exmaple an email address.
You want to make sure the email is entered, and then you want to
make sure it's a valid email and then you might further still want
to make sure this email is only from a certain domain. It can all
be as complex as you want it to be.
I have done you an example, but it is only checking one field
and that something is entered. Try submitting it with text AND then
try submitting it without - you should soon see how the logic is
constructed. Hopefully this will give you a basic idea of how to
build form logic.
In terms of a captcha, if you're using CF8, you can use the
CFIMAGE tag, it has a captcha feature.
In terms of sending an email, check out the CFMAIL tag.
In terms of a voucher code and checking its validity, you
might need a database to compare it to, or you could perhaps hard
code it - it's up to you.
<cfif isDefined("form.exampleSubmit")>
<cfif not len(form.exampleText)>
<p>The field is empty!</p>
<cfelse>
<p>You wrote:
<cfoutput>#form.exampleText#</cfoutput></p>
</cfif>
</cfif>
<form
action="<cfoutput>#cgi.script_name#</cfoutput>"
method="post">
<input type="text" name="exampleText" value="" />
<input type="submit" name="exampleSubmit" value="Submit
Form" />
</form>
Good luck,
Mikey.