### Model
table_test_two = db.define_table('test_two',
Field('name', 'string'),
Field('number', 'list:integer'),
)
db.commit()
### Controller
def sample_two_validate(form):
# --> This does not work in py4web - whereas it worked in web2py:
# (the name stays unchanged in py4web)
form.vars['name'] = "Hellow"
# --> This works both in py4web and web2py:
form.vars['number'].append(42)
@action("sample_two")
@action("sample_two/<path:path>")
@action.uses("generic.html")
def index(path=None):
# testtwo: test validation function
grid = Grid(path,
validation=sample_two_validate
)
return dict(grid=grid)