This is a great example of how to handle repopulation upon errors for a regular form, but how would you handle this for a registration form when using the built-in authentication? The user() controller in default is pretty much blank except for return dict(form=auth()) .
Any help would be greatly appreciated. Jim On Jan 10, 3:18 am, Jeff Bauer <jeffru...@gmail.com> wrote: > form.vars.update(request.vars) <-- what I was looking for, thanks. > > I also appreciate the simplified code. The original code posted > was taken from page 193 of the web2py manual. > > -Jeff > > On 01/09/2010 11:32 PM, mdipierro wrote: > > > > > You can simplify your code > > > def diag_form(): > > form = SQLFORM(db.socdiag, request.args(0), deletable=True) > > if form.accepts(request.vars, session): > > response.flash = 'form accepted' > > elif form.errors: > > # (1) > > response.flash = 'form has errors' > > return dict(form=form) > > > I am not sure what you asked. Try insert in (1) > > > form.vars.update(request.vars) > > > OR > > > if form.record: form.vars.update(form.record.as_dict()) > > > OR > > > [form.vars[key]=db.socdiag[key].default for key in > > db.socdiag.fields]
-- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.