How To Be a Good Open Source Citizen Slides
May 16, 2013How To Take Over Star Wars – cf.Objective() 2013 Lightning Talk
May 29, 2013Flash RAM is a handy tool in the ColdBox Framework that can easily be used to temporarily store the RC (request collection) data forward one request. As I was using the Flash RAM feature recently, I ran into trouble while attempting to persist the form data back to the original form when a validation error had occurred.
The error encountered was essentially an infinite loop when trying to persist the request collection (RC). You should be able to just persist the RC and re-populate the data and everything should work. Right? Wrong! The infinite loop was created because the event variable also lives in the RC that was persisted. As a result when the redirect back to the form happened the event reference to the save was picked up sending it back to the save/validate and back to the form and back to the save…you get the idea. To fix this, instead of persisting the entire RC structure I used the following line of code to exclude the event variable:
flash.persistRC(exclude="event");
This was all that was needed to resolve the issue. The RC is persisted, your original form data is repopulated, and you are ready to fix your form error and re-submit.