[web2py] Re: repopulating form with data after form.errors encountered

2010-01-10 Thread JimK
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

Re: [web2py] Re: repopulating form with data after form.errors encountered

2010-01-10 Thread Jeff Bauer
As I'm the one with the issue, I'll take a look. I've got no experience with this codebase however and will probably make queries on irc #web2py if anyone's listening. Should I file a bug report? -Jeff On 01/10/2010 09:30 AM, mdipierro wrote: You are right. it s widget problem. It is a bug. I

[web2py] Re: repopulating form with data after form.errors encountered

2010-01-10 Thread mdipierro
You are right. it s widget problem. It is a bug. I will see what I can do but I could use some help on this one. On Jan 10, 8:31 am, Jeff Bauer wrote: > Yes, keepvalues=True is the default.  My form is using the > checkbox widget, and it appears the values aren't retained > upon a form error. > >

Re: [web2py] Re: repopulating form with data after form.errors encountered

2010-01-10 Thread Jeff Bauer
Yes, keepvalues=True is the default. My form is using the checkbox widget, and it appears the values aren't retained upon a form error. Field('inpatient_procedure', 'string', widget=SQLFORM.widgets.checkboxes.widget, Hmmm, the database is updated, but the values aren't displayed on the form

Re: [web2py] Re: repopulating form with data after form.errors encountered

2010-01-10 Thread Jeff Bauer
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.

[web2py] Re: repopulating form with data after form.errors encountered

2010-01-09 Thread mdipierro
That is the default. Are you telling me it is not? On Jan 9, 11:44 pm, Thadeus Burgess wrote: > like request.accept(keepvalues=True)... but only if there was an error. > > -Thadeus > > On Sat, Jan 9, 2010 at 11:32 PM, mdipierro wrote: > > You can simplify your code > > > def diag_form(): > >    

Re: [web2py] Re: repopulating form with data after form.errors encountered

2010-01-09 Thread Thadeus Burgess
like request.accept(keepvalues=True)... but only if there was an error. -Thadeus On Sat, Jan 9, 2010 at 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): >

[web2py] Re: repopulating form with data after form.errors encountered

2010-01-09 Thread mdipierro
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)