Hi all, I'm a fresh newbie using w2p.
I would hope my question is not so stupid, but I've spended a lot of
time trying to resolve myself, without success...

I've this model:

db.define_table('mytable',
   Field('field1','string'),
   Field('field2'))
db.mytable.field2.requires = IS_IN_SET(['option1'],['option2'])

I've already a created record with field2=option1
I want to create a form where users can change the field1 value, but
the field2 value should be automatically setted to option2 only if the
record has been updated.

I tried with:

def update_mytable():
    record=request.args[0]
    form=SQLFORM(db.timbrata,
                     record,
                     onaccept=auth.archive,
 
onupdate=db(db.mytable.id==record).update(field2='option2'),
                     deletable=False)
    return dict (form=form)

But the filed2 is updated just when the form is showed, not, as I
expected, after an update.
Maybe I took a wrong way, someone could help?

Regards, Rocco

Reply via email to