Reputation: 21924
Is there a way in ColdFusion to change a session variable after a page change? - Especially after a page change to a specific page?
Goes to one page --> change session variable
Goes to a different page --> change session variable to something else
Upvotes: 0
Views: 862
Reputation: 119
You can manage this in application.cfm or application.cfc and then this will carry over to every page and subfolder in your application. You would just do an if statement using the CGI variable for the name of the page.
<cfscript>
if (findnocase("page1",cgi.script_name)) {
session.myVar="Variable State 1";
} else if (findnocase("page2",cgi.script_name)) {
session.myVar="Variable State 2";
} else {
session.myVar="Variable State DEFAULT";
}
</cfscript>
Upvotes: 0
Reputation: 14333
Can you add code to the existing page? When importantpage.cfm is loaded you could run this at the top of the page
<cfset session.variable = 'important page loaded'>
That should accomplish what you are looking for.
You could also add <cfset>
tags to your application.cfm/cfc file
Upvotes: 2