Tom Muck

Alpha Dog Blues Band
Home page
All articles
All Extensions | Extension News | Extension FAQs | Customer Login
Books authored or co-authored by Tom Muck
Extensions, books, and other products | Customer Login
Your current cart contents Blog | CMXTraneous Blog | Flash Remoting Blog
About the site


Tom Muck's Blog: Problem with ColdFusion validationTom Muck's Blog

News and Views

Problem with ColdFusion validation

Sunday, December 11, 2005 1:46:51 PM

ColdFusion provides several decent validation techniques. One of the easiest to implement was using hidden form fields -- for every field you want validated, include a hidden field with the same name with an underscore followed by the validation type. For example, to validate a required text field named "firstname" you would add a hidden field named "firstname_required". It was not 100% secure, but quick-and-easy to implement for non-critical data. Server-side validation using hidden fields seems to be broken in CF 7. This works in CF 6:

<cfif isdefined("form.textfield")>
  <cfset tast = form.checkbox>
<form id="form1" name="form1" method="post" action="">
  <input type="text" name="textfield" />
  <input type="checkbox" name="checkbox" value="checkbox" />
  <input type="hidden" name="checkbox_required" value="Must check box" />
  <input type="submit" name="Submit" value="Submit" />

In CF 6.1 and earlier, if you fail to check the box, CF will issue a controlled validation error message "Must check box". In CF 7, CF fails and errors out: "Element CHECKBOX is undefined in FORM." I've filed a bug on it, but I wonder how many exisiting applications are failing because of this feature. I had to rewrite a few things to take the bug into account, since I am running the site on CF 7 now.

Category tags: ColdFusion

Before posting comments or trackbacks, please read the posting policy.

Full Blog Calendar

Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
About | Privacy Policy | Contact | License Agreement | ©2002-2023 Tom Muck | Dreamweaver Extensions