I need to have a form generated via SQLFORM where the initial values of the fields are pre-filled with dynamically generated content. What I am trying is (suppose I have a table mytable with title and content as fields):
form = SQLFORM(db.mytable) form.vars.title = "my title" form.vars.content = "my content" if form.accepts(request.post_vars, session): <some code> return dict(form=form) Yet, if I do this, I get an error that says: <type 'exceptions.SyntaxError'>(No fields to update) So, how can one define dynamically the values that appear initially in a SQLFORM? I know that I can define defaults in the models definition, but I want to do it dynamically. What is the way to do it? And why do I get the above error? Many thanks, Luca