A user working on a Facebook application ran into an interesting problem this morning. Form data was being sent to his server with field names that included a bracket. So instead of a simple form.foo variable, he was sent form.foo. When he attempted to make use of the field…
ColdFusion threw an error. No big surprise there. The solution though is to simply treat the form as a structure:
If you wanted to copy the values you can use:
<cfset saneList = form["foo"]>
You get the idea.
By the way, I will use this opportunity to remind people of another Facebook issue, and that’s with the use of form fields that turn on ColdFusion’s ancient automatic form handling. I discuss a workaround here, but you should remember that ColdFusion 9 now includes a fix for this behavior. Simply include this.serversideformvalidation=false in your Application.cfc. To be clear, it doesn’t turn off any server side validation you write. It simply disables the old automatic validation that no one uses (except when they accidentally run into it).