sameformfieldsasarray in Application.cfm

193 views Asked by At

I am working on a Legacy Application and they are using Application.cfm, now that file cannot be converted to Application.cfc due to the fact that the site is too big and probably making a change will make it unstable

In one of the Pages, I have defined the form field as: keys[] to return me an array. I have defined the

<cfset this.sameformfieldsasarray = "true">

in Application.cfm under the cfapplication tag

But that does not seems to be working, it just creates the list rather than an array.

So Question is:

  1. How can i use that function?
  2. If i cannot use that function in Application.cfm, is there any other way to use it in The Page only where I need to the form value as an array

i am using coldfusion Version 11

2

There are 2 answers

6
James A Mohler On

I think you are setting the value to be a string rather than a boolean

<cfset this.sameformfieldsasarray = "true">

Should be

<cfset this.sameformfieldsasarray = true>

Also consider using application.cfc

0
charlie arehart On

OP's mistake was in trying to set that sameformfieldsasarray setting via a cfset of the this scope AFTER ("under") the cfapplication they had. That would be appropriate only in an application.cfc. When using application.cfm instead, they should have simply set it as an attribute of the cfapplication tag:

<cfapplication sameformfieldsasarray="true"> (or false, if desired)

Sadly, most docs and resources mentioning this sameformfieldsasarray feature (and other features that can be set in the this scope of an application.cfc) tend to not mention how nearly all of them can be set as attributes of cfapplication as well.