Value missing from form.fieldnames in ColdFusion

coldfusion

I must be losing my mind.

<cfif cgi.request_method eq "POST">
    <cfoutput>
        Form.fieldnames = #form.fieldnames#<br>
        structKeyList(form) = #structKeyList(form)#
    </cfoutput>
</cfif>

<form  method="post" accept-charset="utf-8">

    <input type="text" name="graduation_date" value="x"><br>
    <input type="text" name="foo" value="y"><br>
    <input type="text" name="bar" value="z"><br>

    <input type="submit" value="Submit Form" >

</form>

The form.fieldnames variable should include a list of submitted fields: foo, bar, and graduation_date. But graduation_date is missing.

After a little more testing, I see that anything ending in _date is excluded from form.fieldnames.

I was going to ask what's wrong with my code, but now I'm pretty convinced it's a bug in ColdFusion. (I'm on ColdFusion 8.0.1 / OS X 10.5.6.)

It's a bug in ColdFusion, right?

Best Answer

Maybe it's the custom validation feature (aka "Validating form data using hidden fields")?

Essentially, by using some specifically formatted form fields (field_required, field_date, field_integer, etc.) you can perform server-side validation of your forms.

This goes back several versions of ColdFusion, back when CFFORM wasn't very robust and keeps you from having to write validation code for every one of your form fields. There are better ways to do this now, but it's still in there for backwards compatibility.

Related Topic