I've used response.flash before but I'm just not following the work
flow here. I'm sure I'm missing something easy so maybe someone can
point out what I'm missing.
I'm using a SQLFORM.facotry to generate a form which consist of
several Boolean fields. It's built as a list of fields looking like:
fields.append(Field(name, 'boolean', label=name, \
default=find_default(name)))
In the view I display the various check boxes with the custom form
widgets.
Everything works as expected when I check form.accepts I can set a
response.flash and it shows up. However, the check box does not show
the proper value until the page is reloaded. To account for this I
added a redirect at the end of the form.accepts to force a page
refresh. This worked but now response.flash doesn't show up.
I actually accidentally fixed this when I made a typo and set
session.flash instead of response.flash as I normally did. So now I'm
left puzzled as it seems to work with the session.flash and a
redirect.
Can someone briefly explain when response.flash vs session.flash
should be used? Additionally, does session.flash get cleared after
display or could it show back up somewhere else?
Finally, is setting session.flash and redirecting the proper way to
use the 'flash' div and update a form for the current submission or is
there a better suggestion?
None of this is crucial, just thought I understood this and stumble
across something I didn't even knew existed.