Maybe it is not a form onupdate action that I need.
I guess that to dinamically update field "b" in the form I need to attach a
JQUERY action to the custom field "a" , but I don't know how to do it.
For instance I would like that during updating, when the user writes 5 in
the field "a', field "b" becomes 5+2
index.html
{{extend 'layout.html'}}
{{if grid.update_form:}}
{{=grid.update_form.custom.begin}}
{{=grid.update_form.custom.widget.a}} ## WHEN a CHANGES I WOULD LIKE TO
MAKE b CHANGE
{{=grid.update_form.custom.widget.b}}
{{=grid.update_form.custom.submit}}
{{=grid.update_form.custom.end}}
{{else:}}
{{=grid}}
{{pass}}
On Thursday, October 4, 2012 9:49:27 AM UTC+9, alex wrote:
>
>
> I have a SQLFORM.grid.
> When the user updates field 'a' in the grid, before submitting the form,
> field 'b' should represent a calculation based on value of 'a'.
> For instance b=a+1
>
> db.py
> db.define_table('t',
> Field('a', type='integer'),
> Field('b', type='integer')
> )
>
> default.py
> def index():
> grid = SQLFORM.smartgrid(db.t)
> return locals()
>
> index.html
> {{extend 'layout.html'}}
> {{=grid}}
>
> Someone can help?
>
--