First off, thanks for taking the time to read and potentially answer this question. Also, I'm a relative noob to CF.
I have a .cfm file which gets called when a user fills out a web form (i.e. the form action points to it with a method of POST). That .cfm then POSTs another form to a data-tracking endpoint, and proceeds to the next user-facing view.
The problem I'm running into, and I've run into so far throughout this Mura project, is that the Application scope doesn't work the way I'd expect it to. For example, I set application vars like so:
<cfif isDefined(form.campaign) AND len(form.campaign) >
<cfset application.campaign = form.campaign />
<cfelse>
<cfset application.campaign = 'default' />
</cfif>
<cfif isDefined(form.channel) AND len(form.channel)>
<cfset application.channel = form.channel />
<cfelse>
<cfset application.channel = form.channel/>
</cfif>
Which if cfdump'd in this context comes out to the expected values based on what I'm passing it. However, once I forward on to the next view (using cflocation
), and cfdump
the application scope, those two keys aren't available.
I was under the impression that application scope was supposed to persist for the the session, more or less?
TLDR: Make sure there is only one instance of Application.cfX anywhere in your application.
A team member had created a file called application.cfm in a higher level of the directory than Application.cfc, which took precedence over the proper file and broke a ton of stuff.
It was added to try to make HTTP requests to .cfm files used for business logic/form processing. This permitted that, but created many other problems.
Removed that file from the directory, moved form processing logic to /remote (which Mura supports for HTTP requests) and refactored some code; application and session scopes are once again available throughout the application, as is Mura($) scope.