Form Data in Field Order Part II

As a follow up to yesterday's post and the comments by "Some guy", I did a bit of experimenting with form.fieldnames versus getHttpRequestData().content. There are some significant differences in how the two treat form data:

form.fieldnames

  • All uppercase field names
  • No values (use form[fieldname] to access)
  • Comma-delimited
  • Form[fieldname] values are automatically URL decoded by ColdFusion
  • Only one field name is output even when multiple fields had the same name in the form

getHttpRequestData().content

  • Case of field names matches case used in HTML form
  • FieldName=Value syntax
  • Each name/value pair delimited by an ampersand
  • Both the name and the value are URL encoded (e.g. spaces are replaced by the plus sign, the @ sign is replaced by it's hexadecimal equivalent, etc.)
  • Multiple fields with the same name in the form are output multiple times (according to their location in the form)

In the end, I decided to switch over to using the form.fieldnames because of the automatic URL decoding.

This discussion has been an exercise in humility since: (1) I have been working with ColdFusion since version 4.0, (2) I have used form.fieldnames before, (3) but I have never noticed nor read anyone (that I recall) that the fields are listed in the form order.

Related Blog Entries

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.8.