I have this handler at /handlers/conan.cfc:
component {
function flash_test(event, rc, prc) {
if (flash.exists(“testvar”)) {
prc.existed = true;
}
else {
prc.existed = false;
flash.put(“testvar”, 123);
}
event.setView(view=“flash_test”, noLayout=true);
}
}
And this view that’s used by that handler:
Flash data was present. Flash data was not present.#Now()#
What I expect to happen, is that the first time I visit the page, I see “Flash data was not present”, and the value 123 would be put into the testvar key in flash scope. Upon reloading the same page, testvar would be found in flash, I would see the message “Flash data was present”, and the variable would be cleared from flash upon completion of the event. If I continue reloading the page, I would expect to see it alternate between “Flash data was not present” and “Flash data was present.”
If I have debugging turned off, that’s exactly what happens–it alternates between the two outputs. However, if ColdBox debugging is turned on, it never shows that the flash variable was persisted. All I ever see is “Flash data was not present”.
Any idea what I’m doing wrong?
Thanks,
Conan