Thanks Khalil,
I did a try but it did not work, in fact the form.vars.t_revision does not
exists.
1. Could it be because I'm using SQLFORM.grid ?
2. I was aware that we can paste a list to onvalidation, but never a dict
( onvalidation={'onsuccess':mycustom} ), is this in the docs ?
I would have prefered to do it in the DAL, but anyway, I tried in the
controller, and here is a possible solution. This is definitely not simple,
but it works :
@auth.requires_login()
def manage_templates():
def increment_rev_number(form):
print('Enter increment_rev_number : form.vars = %s' %
(str(form.vars)))
print( db(db.t_templates.id==form.vars.id).select().first() )
db(db.t_templates.id==form.vars.id).update(
f_revision =
(db(db.t_templates.id==10).select().first()['f_revision'] or 0) + 1
)
db.commit()
form = SQLFORM.grid(
db.t_templates,
fields=[
db.t_templates.f_name,
db.t_templates.f_template,
db.t_templates.f_revision,
db.t_templates.f_revdate,
],
csv=False,
details=False,
onvalidation=auth.archive,
onupdate=increment_rev_number,
)
return locals()
I just noticed the solution provided by Anthony, I'll also give it a try.
Thanks Anthony.

