cfform Server Side Validation Gotcha

Posted By : todd sharp Posted At : February 27, 2007 4:05 PM Posted In: ColdFusion

3

Want to aggravate yourself for 10 minutes? Try this one. Create a cfform. Name a form field "foo_required". Add no other validation whatsoever. Submit the form without populating the field. Go crazy for 10 minutes until you realize that any field names that end in "_required" trigger CFs server side validation. We learn something new everyday huh?

Comments (3)

Chris's Gravatar Uhhmm... actually that is taught in FTCF classes. ;-)

You might try the following suffixes, too:
_integer, _float, _range, _date, _time, _eurodate

Best,

Chris

Ryan Everhart's Gravatar I'll file that under "good to know"! Thanks for the insight!

Dan's Gravatar I spent more than 10 minutes trying to figure this out this morning! Thanks for listing the list of suffixes that can cause the problem.

I noticed that if you use a regular form and have a form field that uses one of these suffixes, the field will go missing from the fieldnames variable. However, the content of the variable will still be present in the form (if you do a cfdump).

I met this problem trying to figure out why a form variable wouldn't appear in the attribute scope while using the FormURL2Attribute custom tag. It had the suffix _date.