I tried here, and you can use FORM() If your raw html is <form name-'foo' action='index'><input type='text' name='bar'></form>
you need index to: form=FORM(INPUT(_name='bar',_type='text',requires=IS_NOT_EMPTY(error_message='it is empty'))) errors=form.errors if form.accepts(request.vars,session=None,formname='foo'): redirect(URL(r=request, f='index')) elif form.errors: return dict(errors=form.errors) return dict(errors=errors) The same as SQLFORM.factory, but this is pure HTML. 2010/10/19 Bruno Rocha <rochacbr...@gmail.com> > Not sure, but I think you need to specify a form object in order to use > .accepts to validate > > from the book: > All the work is done by the accepts method of the form object. It filters > the request.varsaccording to the declared requirements (expressed by > validators). accepts stores those variables that pass validation into > form.vars. If a field value does not meet a requirement, the failing > validator returns an error and the error is stored in form.errors. Both > form.vars andform.errors are gluon.storage.Storage objects similar to > request.vars. > > So: > > You can try to create a form object using > > form = SQLFORM <http://web2py.com/book/default/docstring/SQLFORM>.factory > > But, this form created by .factory needs to have the same model as the one > you created in raw html. > > you can try to loop the request.vars to build a instance of form object > with the validators that you want, then you will be able to use .accepts() > > I am really not sure, But by now, I think it is the only way. > > > 2010/10/19 Bruno Rocha <rochacbr...@gmail.com> > > What is the name of the form, really? >> >> Which one you specified in <form name=""> does not works? >> >> 2010/10/19 weheh <richard_gor...@verizon.net> >> >> If I build a form comprising a few raw html input fields and then use >>> ajax to submit them, their values end up in request.vars. Now, I would >>> like to use my_html_form.accepts(...) to process the contents, but is >>> that possible? What is the name of the form, really? >>> >> >> >> >> -- >> >> http://rochacbruno.com.br >> > > > > -- > > http://rochacbruno.com.br > -- http://rochacbruno.com.br