On 26 Nov, 18:06, Anthony <abasta...@gmail.com> wrote:
> On Saturday, November 26, 2011 11:40:27 AM UTC-5, Rocco De Marco wrote:
>
> > db.mytable.field2.requires = IS_IN_SET(['option1'],['option2'])
>
> I think you want:
>
> IS_IN_SET(['option1', 'option2'])
>

Yes, it is a my mistake...

> > 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)
>
> I don't think SQLFORM takes an onupdate argument, and you would need to
> call SQLFORM.accepts, SQLFORM.validate, or SQLFORM.process after creating
> the SQLFORM in order to get validation/updating to happen. Perhaps you mean
> to use SQLFORM.grid() -- that does take an onupdate arg, but it must be a
> function (e.g., a lambda). But why are you automatically setting field2 to
> 'option2' on update -- don't you want to let the user choose the option? If
> not, make sure field2 isn't shown in the form.
>

I'll try these things, starting with sqlform.grid(), that maybe is
what I'm looking for...

> I recommend giving the relevant sections of ch. 7 a good
> read:http://web2py.com/book/default/chapter/07
>
> Anthony

Many thanks,
Rocco

Reply via email to