Charlie, I suspect that you misunderstand it as I, too, did initially. The issue is not about the form field xxx_date. It is about the list form.fieldnames.
Apparently, when a form field is named xxx_date, then that name is missing from the list form.fieldnames. This has been known for quite some time. The Stackoverflow link in my previous post points to a report of the issue over 15 years ago.
It is clear that, regarding form field names, ColdFusion treats words that end in _date as reserved words. In fact, the same goes for words ending in _integer ,_time ,_eurodate ,_range or _float, as the following demonstration shows.
That this has to do with validation is no surprise. The name endings, integer, time, date, etc., are among the values of the type attribute of the isValid function.
Demo:
Launch the CFM page and press the submit button.
<cfif structKeyExists(form, "fieldnames")>
<h2>
Field names in <i>form.fieldnames</i>
</h2>
<p>
<cfscript>
// The list form.fieldnames
fieldNamesList=form.fieldnames;
closure=function(item){
WriteOutput( item & "<br>"); // list each item on separate line
}
fieldNamesMap=listMap(fieldNamesList,closure);
</cfscript>
<h2>
Field names not in <i>form.fieldnames</i>
</h2>
<p>
<cfscript>
//The form fields not in form.fieldsname
closure=function(key, value){
if (!listContainsNoCase(fieldNamesList, key)){
// list on separate line each not in fieldNamesList
WriteOutput( key & "<br>");
}
}
formFieldsMap=structMap(form,closure);
</cfscript>
</p>
<cfelse>
<p>
<cfoutput><form action="#cgi.script_name#" method="post"></cfoutput>
xxx_array: <input type="text" name="xxx_array"><br>
xxx_boolean: <input type="text" name="xxx_boolean"><br>
xxx_creditcard: <input type="text" name="xxx_creditcard"><br>
xxx_date: <input type="text" name="xxx_date"><br>
xxx_eurodate: <input type="text" name="xxx_eurodate"><br>
xxx_email: <input type="text" name="xxx_email"><br>
xxx_float: <input type="text" name="xxx_float"><br>
xxx_guid: <input type="text" name="xxx_guid"><br>
xxx_integer<input type="text" name="xxx_integer"><br>
xxx_numeric<input type="text" name="xxx_numeric"><br>
xxx_query: <input type="text" name="xxx_query"><br>
xxx_range: <input type="text" name="xxx_range"><br>
xxx_regex: <input type="text" name="xxx_regex"><br>
xxx_ssn: <input type="text" name="xxx_ssn"><br>
xxx_string: <input type="text" name="xxx_string"><br>
xxx_struct: <input type="text" name="xxx_struct"><br>
xxx_telephone: <input type="text" name="xxx_telephone"><br>
xxx_time: <input type="text" name="xxx_time"><br>
xxx_uuid: <input type="text" name="xxx_uuid"><br>
xxx_usdate: <input type="text" name="xxx_usdate"><br>
xxx_xml: <input type="text" name="xxx_xml"><br>
xxx_zipcode: <input type="text" name="xxx_zipcode"><br>
<br><input type="submit" name="submitForm" value="submit">
</form>
</p>
</cfif>
<cfdump var="#form#" >
Result:
On the subject of form field names, there is yet another curiosity. ColdFusion treats words that end in _required as reserved words.
... View more