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 will see what I can
do but I could use some help on this one.

On Jan 10, 8:31 am, Jeff Bauer<jeffru...@gmail.com>  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.

Field('inpatient_procedure', 'string',
      widget=SQLFORM.widgets.checkboxes.widget,

Hmmm, the database is updated, but the values aren't
displayed on the form even when they exist, so it's a widget
problem I suppose.  For completeness:

db.socdiag.inpatient_procedure.requires = IS_IN_SET([ \
      'NA - Not applicable','UK - Unknown'])

-Jeff

On 01/10/2010 12:25 AM, mdipierro wrote:

That is the default. Are you telling me it is not?

On Jan 9, 11:44 pm, Thadeus Burgess<thade...@thadeusb.com>    wrote:
like request.accept(keepvalues=True)... but only if there was an error.

-Thadeus

On Sat, Jan 9, 2010 at 11:32 PM, mdipierro<mdipie...@cs.depaul.edu>    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]

Does of them solves your problem?

On Jan 9, 5:12 pm, Jeff Bauer<jeffru...@gmail.com>    wrote:
I'm following another example in the manual using SQLFORM.
The code works as advertised.  The only fly in the ointment
is when form.errors is True, the user's entry form no longer
displays her original values.  I'm assuming there's a simple
way to pass the request vars back into form at line 11
before return.

    1 def diag_form():
    2    if len(request.args):
    3        records = db(db.socdiag.id==request.args[0]).select()
    4    if len(request.args) and len(records):
    5        form = SQLFORM(db.socdiag, records[0], deletable=True)
    6    else:
    7        form = SQLFORM(db.socdiag)
    8    if form.accepts(request.vars, session):
    9        response.flash = 'form accepted'
10    elif form.errors:
11        response.flash = 'form has errors'
12    return dict(form=form)

Jeff Bauer
Rubicon, Inc.

--
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 
athttp://groups.google.com/group/web2py?hl=en.


-- 
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.


Reply via email to