Here is a feature that was missed from the docs that I think folks will be happy about. Credit for this find goes to Joe Zack and I'd like to thank Adam Cameron for bringing it to my attention. (And the proper people have been notified about the doc issue so hopefully the online versions will be updated soon to reflect this.) When posting form fields to a ColdFusion page, any form field with the same name will have its values combined into one variable. So consider the following simple script:
Given input of Ray and Camden, you will get a form variable called NAME with a value of Ray,Camden:

That's all well and good and ColdFusion makes it easy to parse that into separate values with list functions, but what happens when you enter "Camden,Ray" and "Foo"?

At this point, it is impossible to tell what the user really entered. Maybe they had "Camden" as the first value. Maybe it was "Camden,Ray". There is no way to properly tell what was put in each field.
Now - to me - the best fix is to simply use unique form field names. But we don't always have control over that. There is a work around you can use, but it would be nice if it was built in.
Turns out - ColdFusion 10 has a feature just for this. Simply by adding one setting to your Application.cfc file, you can convert these values into arrays automatically:
The new setting, sameformfieldsasarray, will enable this feature and generate the array on submission:

It looks like Scott Stroz actually blogged this way back in February and I (and probably many others) completely forgot it!
There is one small caveat that may or may not matter to you. What do you think happens if you leave the first field empty and enter a second item? You get an array of one item. Now - that may be fine for your needs. But if you really want to know that the first field was blank, you would need to check with getHTTPRequestData as mentioned in my earlier fix.
Archived Comments
Scott also mentioned it on a CFHour podcast; that's where I remember it from.
Or you can use my Form Utilities CFC (http://formutils.riaforge.o... which does far more. :-)
I've been trying to get them to build this in for a while but interestingly, the bug tracker issue was marked as a duplicate for the fix you mention here, even though it's definitely not a duplicate! I'll have to pester the dev team...
Great to see this is built into CF10. I wrote a function that pulls form fields as an array that can be used on older versions of CF. Its on CFlib: http://cflib.org/index.cfm?...
and here is my blog post about it: http://www.stillnetstudios....
I wonder if the CF10 feature handles multipart/form-data POSTs? That was something I had to work around in my function.
Ryan: Try it and see. ;)
This will definitely make a particular class of problems a lot easier to solve. No more passing extraneous, hidden elements as additional identifiers for groups of elements.
Unfortunately this seems to get more complicated when you have input names with differing cases. Try the following in CF10...
<form method="post">
<input type="text" name="name">
<input type="text" name="NAME">
<input type="text" name="name">
<input type="submit">
</form>
...and the form struct will only have the value from the middle input. What's going on here?
I'm not seeing this with CF10/latest patch. Are you fully patched?
Raymond - Thanks, you're right. It must have been a bug that was fixed in one of the recent updates. If anyone else experiences this in CF10 (before update 9), just do an update to the latest. It's fixed as of update 11.
So - I just recommended this to a CF noob... and then I remembered the damn "if blank, compact the array" - which totally makes this pointless. He had 3 sets of fields, and really needs them to match up.
Damn.
Looks like a bug was filed: https://bugbase.adobe.com/i...