If using form.process(), I think the arg would be 'onsuccess', not 'onaccept'.
Anthony On Saturday, November 26, 2011 12:50:41 PM UTC-5, Massimo Di Pierro wrote: > > I THINK YOU WANT: > > def update_mytable(): > record=request.args[0] > form=SQLFORM(db.timbrata, > record, deletable=False) > form.process(onaccept=lambda form: ( \ > auth.archive(form), > form.record_id and > db(db.mytable.id==form.record_id).update(field2='option2'))) > return dict (form=form) > > On Nov 26, 10:40 am, Rocco De Marco <rocco....@unicam.it> wrote: > > 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 > >