I think something like the following would give you what you want:

def index():
  form=SQLFORM(db.mytable)
  if form.accepts(request.vars,session):
    response.flash="Record added"
  records=db().select(db.mytable.ALL)
  return dict(form=form,records=records)



On Dec 14, 8:15 pm, Fran <[email protected]> wrote:
> I have a fairly typical design of page for this environment:
> List of existing items
> Form to add a new item
>
> When I submit my form, I get my flash saying that item has been added
> (& indeed db is updated correctly), however I don't get the list of
> items refreshed....so users will be uncertain.
> I can do a redirect to re-load the page, but then I don't get the
> flash coming through.
>
> I /could/ write a bunch of Javascript to get the list part refreshed
> within the page, but a simpler-seeming way would be to add a meta-
> refresh tag to get the page to refresh after the flash has been seen.
> In the header section of the layout, add:
> {{if response.refresh:}}{{=refresh}}{{pass}}
>
> In the form.accepts, add:
> response.refresh='<meta http-equiv="refresh" content="2; url=' + URL
> (r=request,f='application') +'">'
>
> (application would be the same as the one you've just left, but want
> this to avoid the page continually reloading - just want that once)
>
> However response.refresh isn't supported & I can't see where to extend
> gluon to get it supported.
>
> It seems generically useful enough to go into core anyway, right?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to