Flash settings in Coldbox.cfc (see attached config code) are not applied in my app (see attached View). Why is flash set to keep=true, when I dump flash.getFlash() in my view? last_url is also polluted with some un-purged random content that causes a redirect error to last_url when the handler processes validation errors on any of my forms. Notice that the default setting is auto purge = true. Coldbox tracker is also attached.
I finally found an answer after nearly two months… to this rather tricky issue.
RedirectBack() relies on the Flash scope to find the last URL. Since the Flash storage appears to be buggy (as it carries some random value, but not the actual last URL value) I need to override the last_url content with the correct URL value for validation errors to be displayed on the newCandidate view.
In the handler, I had to redefine the redirected URL and pass it to the redirectBack() function:
prc.redirectedURL = "personnel.hire.candidates.newCandidate";
if ( result.hasErrors() ) {
flash.put( "candidate_form_errors", result.getAllErrorsAsStruct() );
redirectBack(prc.redirectedURL);
return;
}
and now… my validation errors appear on the correct view and no longer go to a 404 error page.
I am having the problem with _securedURL from cbSecurity module. The value of _securedURL seems to be random. Redirecting back is a good temporary solution.
Yes, redirectback(newURL) worked for me to fix a similar problem with the flash scope.