I am having problem with form validation and update of record actually. I try to update a record for now :
def grid_into_form():
grid = SQLFORM.grid(db.tab1,
_class="web2py_grid",
links=[lambda row: INPUT(_name='result', _class='decimal')],
create=True,
editable=True,
paginate=5)
return dict(grid=grid)
View :
<form>{{=grid}}<input type='submit'/></form>
I get input for every records in the table. But since I use html form tag I wonder how I could use validators... I try to put the grid in a form at the controller level like this (not successfully) :
def grid_into_form():
grid = SQLFORM.grid(db.tab1,
_class="web2py_grid",
links=[lambda row: INPUT(_name='result', _class='decimal')],
create=True,
editable=True,
paginate=5)
form = FORM(grid)
if form.accepts(request,session):
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill the form'
return dict(form=form)
Also, how could I generate a grid of say 20 rows with only blank input for every fields of a given table (so kind of empty rows)?
Thanks
Richard