Form Fields with the same name – ColdFusion 10

In ColdFusion when you submit form, and the form contains multiple form fields with the same name (a list of checkboxes, for example) that these values will be available to us as a comma-delimited list in the FORM scope.

ColdFusion 10 gives us the ability to transform these lists into arrays automatically. It is as easy as adding the following to Application.cfc


this.sameformfieldsasarray = true;

Now, anytime you submit a form where more than 1 form field share a name, the value of FORM.{fieldName} will be an array instead of a list.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s