Our Forums are now closed. Please go to our Google Mailing List for help. This site will remain open for historical purposes.
ColdBox Framework Forums Home | Profile | Search | Login | RSS

 pdf Print PDF   Previous Page  Page: 1   Next Page

Thread: view refresh problem
Created on: 03/16/10 08:41 PM Replies: 5
Leftbower
Rookie

Joined: 02/09/09
Posts: 13
view refresh problem
03/16/10 8:41 PM

I am obviously making a 'fundamental' mistake here and so I need a little bit of help... I have an ordering system and when an order is verified I need to do 2 things:

1 -- display a confirmation page with the order details and
2 --- send an email with the same info

simple, right? So my eh basically checks for successful order and then:

1 --- generates the 'order detail' and puts it into a content variable in the rc. It does this through a RunEvent(ehCheckout.createOrderDetail') command.
2 --- call email service and pass in the content variable.
3 --- sets the next event to the confirmation page, persisting the order detail: setNextEvent('ehCheckout/confirmation',persist='orderDetail')
4 --- confirmation view just cfoutputs the content variable 'orderDetail'

All works perfectly fine as expected... until I hit the refresh button on the browser at the confirmation page and I get an error saying that there is no 'orderDetail' in the rc any longer.

I know I just have the flow wrong here, but I cannot grok the correct flow for this??
Link | Top | Bottom
lmajano
Veteran Master

Joined: 01/29/05
Posts: 1209
RE: view refresh problem
03/17/10 12:43 PM

This is the basics of the flash ram, it persists for 1 request only. After that it is cleared UNLESS you tell it to persist longer.

I am guessing you are doing this in coldbox 3.

First of all, try using the flash object as it is more descriptive. So in your eh, use something like

flash.put("orderDetail",rc.orderDetail");

Then in your eh where you redirect, make sure you keep the variables in case of refresh:

flash.keep("orderDetail") //just for that variable or
flash.keep() // for all flash ram variables.

This HAS to be in the event that is refreshed, because it basically tells the flash ram to keep its state once more. If the user visists another event after that, then it get's cleared for you.
Luis Majano
Link | Top | Bottom
Leftbower
Rookie

Joined: 02/09/09
Posts: 13
RE: view refresh problem
03/17/10 8:20 PM

Thanks Luis! (Yes, v3.0.0M4)

I tried to read up on the FlashRAM object but get this error when looking for docs on it:

http://wiki.coldbox.org/wiki/FlashRAM.cfm


FlashRAM
There is no page to be found under the title 'FlashRAM'


Can you point me to a place where I can get more familiar with this?

Thanks!
Link | Top | Bottom
lmajano
Veteran Master

Joined: 01/29/05
Posts: 1209
RE: view refresh problem
03/18/10 11:04 AM

Yes, I am still working on the guide.

For now read this:

http://wiki.coldbox.org/wiki/WhatsNew:3.0.0.cfm#ColdBox_Flash_RAM

The API of the flash scopes:
http://www.coldbox.org/api

Look for: coldbox.system.web.flash

http://wiki.coldbox.org/wiki/EventHandlers.cfm#Persisting_Flash_Variables
Luis Majano
Link | Top | Bottom
Leftbower
Rookie

Joined: 02/09/09
Posts: 13
RE: view refresh problem
03/18/10 1:25 PM

Thanks Luis... but I guess I am still not doing something right?

I added the flash.put in my eh:

flash.put("orderDetail",rc.orderDetail);

and the flash.keep into the event that is being refreshed (in this case, 'checkout.confirmation'):

flash.keep("orderDetail");

when I dump the session scope at the bottom of the page, it shows the 'orderDetail content in the cbox_flash_scope with 'keep' and 'inflatetoRC' set to true.

But if I hit the refresh button on the browser, I still get an error and the session dump shows the cbox_flash_scope struct as empty?

I'd sure love to see even a rough draft of that guide!!
Link | Top | Bottom
lmajano
Veteran Master

Joined: 01/29/05
Posts: 1209
RE: view refresh problem
03/18/10 3:22 PM

That is how I have my apps, if keep=true, then a refresh should keep it.

There has to be something else going on
Luis Majano
Link | Top | Bottom

Galleon Forums V1.7.008 was created by Raymond Camden