FlashRAM and cbox_flash_scope

Hi,

I'm running CF9, ColdBox 3

I'm trying to build a simple 4 step wizard and wanted to use FlashRam
for this.

I have the following cfm files

dspStepOne
dspStepTwo
dspStepThree
dspStepFour

In my event handler, between each step I call an event handler method
like below to process the form data from Step One. Below is a
snippet:

<cffunction name="dspStepOne" access="public" returntype="void"
output="false">
  <cfargument name="Event" type="any">
  <cfset var rc = Event.getCollection()>
   <cfset Event.setView(name="app/dspStepOne",layout='Layout.MyApp) />
</cffunction>

<cffunction name="processStepOne" access="public" returntype="void"
output="false">
    <cfargument name="Event" type="any" />
    <cfset var rc = event.getCollection() />
    <!--- Maybe do some stuff here --->
    ....
    <cfset flash.persistRC(include="someVar") />
    <cfset setNextEvent("xehStepTwo") />
</cffunction>

<cffunction name="dspStepTwo" access="public" returntype="void"
output="false">
  <cfargument name="Event" type="any">
  <cfset var rc = Event.getCollection()>
  <cfdump var="#rc#">
  <cfdump var="#session#">
  <cfabort>
  <cfset Event.setView(name="app/dspStepTwo",layout='Layout.MyApp) />
</cffunction>

So when dspStepTwo runs, I can see the value "someVar" in the "request
collection" which is great, but I don't see it in the session scope
variable called "cbox_flash_scope". Note, I dumped both scopes above.

This variable is always empty. I'm wondering how I can store my data
in "cbox_flash_scope" which seems to be in the session scope. Since
I'm building a non-ajax type wizard, I want to make sure if the user
goes back to dspStepOne, that their form values are preserved.
FlashRAM seems to work for going forward in my wizard, but if the user
hits back, what to do, or if the user was on Step 3 and wanted to jump
back to Step 1, how would I leverage FlashRam to do this or should I
just use the SessionStorage plugin?

Thanks,

-West

West,

The flash ram could be used to move through the wizard in a linear
fashion. It is designed to keep the variables alive for one event and
inflate them back into the Request Collection on the next event.

Like you mentioned, I would use the sessionStorage plugin for handling
what you are trying to accomplish.

Curt

The flash ram also has two methods: discard and keep that are used to keep flows linearly or however you like. However the flash ram is not magical you have yo tell it what to keep or what to discard. You can Also use the argument autoclean to false. This means that the flash variable will be cleaned by you and not automatically and behave more like a persistent scope.

So you can do what you want you just can't expect it to read your mind from step to step :slight_smile:

Thanks. I will give it a go.

I got it to work... it was actually "autoPurge", as opposed to
autoClean, but I'm good to go!

LOL, thanks for the tip, I need to go back and read the docs!

YES, I do read the docs myself.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

All of them? However do you have the time???

:slight_smile:

Best Wishes,
Peter