ColdFusion Contact Form in One Easy File - my first CMX tutorial! (free)
Thanks to the good folks at communitymx, I have now joined the ranks with a simple 3-part tutorial of my own - " ColdFusion Contact Forms in One Easy File "
Part 1 of 3 explains, very simply, how to create a single include file, containing a basic contact form that submits to the same page, and processes email, with a custom auto-responder message, using ColdFusion. This little widget can be dropped into any page for an instant contact form, and of course can be modified to contain any fields you like.
Part 2 will focus on preventing spam (not much point using the form without this stuff in place - time to get busy on the next segment!), and Part 3 will explain how to replace the standard CFmail form validation with custom jQuery in-place validation on each field.


I read the first part of your tutorial and I have one comment: you performed a simple server-side validation of the email address by simply checking if it's less than 6 characters long so not to "go into any extensive check of the email address structure":
cfif len(trim(form.senderEmail)) lt 6
You can do a true validation of the email address pretty easily (without using any complicated regex, for instance) by using CF's handy isValid() function. So the check could be written:
cfif isValid("email",trim(form.senderEmail))
[ miuaiga reply ]
Thanks Tony - great suggestion!
I was going to look for a deeper regex check for 'part 2', but did not realize CF already has that built in.
Thanks - I will be sure to add this to the many ways we check for spam!