Since version trunk 288 you can create dummy databases with SQLDB(None) and they can be used to generate form. Here is how.
Define the following helper function:
def form_factory(*a): return SQLFORM(SQLDB(None).define_table(*a))
and now you can create a controller like the following
def index(): form=form_factory('myform', SQLField('name','string',requires=IS_NOT_EMPTY()), SQLField('age','integer',requires=IS_INT_IN_RANGE(0,150)), SQLField('image','upload')) if form.accepts(request.vars,session): response.flash='form accepted' ### do something with form.vars, perhaps redirect somewhere else elif form.errors: response.flash='errors in form' else: response.flash='please fill the form' return dict(form=form)
the form object, returned by form factory, behaves like a SQLFORM except that there is no insert because there is no DB. Notice that the image has been stored in a temporary file under uploads and its new name is in