The form.accepts in the controller checks the fields using their
validators.

The error messages you have to handle yourself in your custom form.
For an example see:
http://web2py.com/book/default/chapter/07#Hide-Errors


On Mar 10, 4:33 pm, Pystar <aitoehi...@gmail.com> wrote:
> So how do I design my forms manually and still have it display error
> messages and use validators?
>
> On Mar 10, 10:25 pm, DenesL <denes1...@yahoo.ca> wrote:
>
> > Because the code to show those errors is in the form created by
> > SQLFORM and that form is neither being returned nor displayed in the
> > view.
>
> > On Mar 10, 4:00 pm, Pystar <aitoehi...@gmail.com> wrote:
>
> > > tried this snippet of code from the web2py book, but it doesnt work
> > > the way I feel it should
>
> > > def display_manual_form():
> > >    form = SQLFORM(db.person)
> > >    if form.accepts(request.vars, formname='test'):
> > >        response.flash = 'form accepted'
> > >    elif form.errors:
> > >        response.flash = 'form has errors'
> > >    else:
> > >        response.flash = 'please fill the form'
> > >    return dict()
>
> > > {{extend 'layout.html'}}
> > > <form>
> > > <ul>
> > >   <li>Your name is <input name="name" /></li>
> > > </ul>
> > >   <input type="submit" />
> > >   <input type="hidden" name="_formname" value="test" />
> > > </form>
>
> > > On submission, if there are errors in the form, it doesnt display any
> > > error messages. why is this so?
>
>

Reply via email to