I want the 'search' variable to be present in the following event.
When I get to that page, if I dump search, I get variable not
defined. If I dump rc, it's not in there either. What am I missing?
Do I need to do something in the handler method for
client.search_results?
Likewise, let's say I called the search service as rc.search =
searchPeople(), then tried to dump rc or rc.search in the handler... I
get the white screen of death in the browser (white page with no other
info). Any idea what that happens?
On your second problem. What is seachPeople() returning. I have seen
the white screen of death (coining that term for myself right now) when
attempting to dump a large object graph because CF chokes. Alternately,
I have seen this when caught in an infinite loop.
I paired down the line spacing for compactness here.
Anyway.. I'm still getting WSOD when trying this.
So next, I remove "rc." and make it just search. I then dump search in the handler. I see my results... which interestingly enough, LOOKS like a dump of rc, since I have keys of FORM, as well as my returned query (and it's whole 152 rows).
So that's when I continue to have persist='search' and leaving rc.search off entirely, but then at the next event, 'search' isn't defined.
So if I try to persist any form of rc, I get WSOD. If I don't use rc, I don't get any data.
When I changed data = "" to data = structNew() all worked.
That makes no sense, you know?
var rc = event.getCollection();
var modelObj = getModel('client');
var data = StructNew();
data = modelObj.searchPeople(
obj:rc
);
Since you're overwriting data on the next line, you could set it to
*any* value at all and it would have no effect whatsoever. You could
also do this instead (which would be better):
var rc = event.getCollection();
var modelObj = getModel('client');
var data = modelObj.searchPeople(
obj:rc
);
You don't want to set rc.search = ""; on the line above the call -
it'll end up being passed into searchPeople() as part of the obj
argument. Try this:
var rc = event.getCollection();
var modelObj = getModel('client');
rc.search = modelObj.searchPeople(
obj:rc
);
I agree, it makes no sense. But the way I discovered it was by creating an empty struct, adding a few keys to it with strings, and then adding my ‘data’ variable to it. That worked, and that’s when I went DUH!!!
I think it would have been fine outside of the framework, but yeah, Coldbox choked on it.
I just ran into an issue where the Flash object is not working as it
did in M5.
Here is my example event handler code that proved I was not crazy (at
least, not yet). When I run it, the variable 'CAT' does not appear in
the request collection. Nothing has changed in the environment. I am
using session for my relocation.
/** Redirects to B */
function A (Event) {
rc.cat = 'Padme';
// This worked in M5
Flash.persistRC('cat');
// Tried This too
Flash.put(name='cat',value=rc.cat,inflateToRC=true,keep=true);
// Redirect
setNextEvent('B');
}
I came to this group to see if anyone else had an issue, and, it looks
like something may have changed with the Flash persistence with M6.
I'll start looking into the source.
They aren’t setting them in the onSessionStart method are they? I’ve seen this done to make cookies expire when the browser closes. The session or client flash storage scopes should still work that way.