I think farcyConstructor is only run in application startup It is a bit late for me and I am not near a computer to help point you in the right direction On Jul 13, 2012 7:02 PM, "Xiaofeng Liu" <[email protected]> wrote:
> Hi folks, > > I'm having issues of setting values in the session scope variables within > farcryConstructor.cfm. > > The scenario is in the farcryConstructor.cfm, I have a condition check to > see if the request is coming from a form submission on another site or it > is user accessing my site directly from the browser. > > So I have sth like this in the farcryConstructor.cfm: > > <cfif StructKeyExists(FORM,'CUSTOMER_ID')> > <!--- The request is coming from a form submission on another site ---> > <!--- Logic A ---> > > > <cfelseif StructKeyExists(SESSION, 'CUSTOMER_ID')> > <!--- Logic B ---> > > > <cfelse> > <!--- If the request is not from a certain form submission and no > customer id has been set up in session, redirect user back to another site > ---> > <cflocation url="http://anothersite.com.au"> > </cfif> > > > Then in the projects/config/_serverSpecificRequestScope.cfm I check if the > form variable exists, if yes, set that in the session scope: > > > <cfimport taglib="/farcry/core/tags/farcry" prefix="farcry" /> > > <cfif StructKeyExists(FORM,'CUSTOMER_ID') AND LEN(FORM.CUSTOMER_ID)> > > <cfset SESSION.CUSTOMER_ID = FORM.CUSTOMER_ID> > <!--- <cfdump var="#SESSION#" label="dumping session 3"> ---> > </cfif> > > <!--------------------------------- > PUT PRODUCTION OR DEFAULT CODE HERE > ---------------------------------> > > <!--- <cftry> > <cfset REQUEST.BRAND_ID = > APPLICATION.HELPERS.CampbellsHelper.getBrand().objectID> > <cfcatch> > <cfset REQUEST.BRAND_ID = createUUID()> > <cfhtmlhead text="<!-- WARNING: No default brand exists for this site. > Please create a brand with the SLUG > '#APPLICATION.HELPERS.CampbellsHelper.DEFAULT_SLUG#' -->"> > </cfcatch> > </cftry> ---> > > <!--------------------------------------------------- > PUT DEVELOPER OR STAGING/TESTING SPECIFIC CODE BELOW > ---------------------------------------------------> > > <farcry:machineSpecific name="DEVELOPER_1_MACHINE_NAME_HERE"> > <!--- DEVELOPER SPECIFIC OVERRIDING CODE HERE ---> > </farcry:machineSpecific> > > > <farcry:machineSpecific name="DEVELOPER_2_MACHINE_NAME_HERE"> > <!--- DEVELOPER SPECIFIC OVERRIDING CODE HERE ---> > </farcry:machineSpecific> > > > <farcry:machineSpecific name="DEVELOPER_3_MACHINE_NAME_HERE"> > <!--- DEVELOPER SPECIFIC OVERRIDING CODE HERE ---> > </farcry:machineSpecific> > > When I tested it, if I access my farcry site directly I get successfully > redirected. However, when I created a form to post customer_id to my site, > the first time, I can successfully jump into the first condition to execute > logic A because form.customer exists. But then if I clicked any links on > that page, I can NOT jump into my second condition to execute logic B. I > found the reason is CUSTOMER_ID is NOT exist in the SESSION scope. But if I > put a dump in the _serverSpecificRequestScope.cfm and do the form > submission, I can see the session actually got set. However, a new request > without form variables exists did not have session variables set either. > > I feel like I'm setting up session variables in the wrong place. > > I have been struggling on this for long. I would really appreciate any > help. > > > > > -- > Best regards, > > Xiaofeng,^_^ > > -- > You received this message cos you are subscribed to "farcry-dev" Google > group. > To post, email: [email protected] > To unsubscribe, email: [email protected] > For more options: http://groups.google.com/group/farcry-dev > -------------------------------- > Follow us on Twitter: http://twitter.com/farcry -- You received this message cos you are subscribed to "farcry-dev" Google group. To post, email: [email protected] To unsubscribe, email: [email protected] For more options: http://groups.google.com/group/farcry-dev -------------------------------- Follow us on Twitter: http://twitter.com/farcry
