Some of the information here may be outdated, please check the book instead

Sometime you want an insert form that, upon submission and after the insert, retains the preceding values to help the user insert a new record. This can be done:

db.define_table('user', SQLField('name','string'))

And in controller

def test():    
    if form.accepts(request.vars,session,keepvalues=True):
        response.flash="record inserted"
    return dict(form=form)

Notice the keepvalues=True argument of the accepts method.

© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by web2py - design derived from a theme by the earlybird
The content of this book is released under the Artistic License 2.0 - Modified content cannot be reproduced.