On Jun 17, 11:22 am, carlo <syseng...@gmail.com> wrote: > From the manual there is no reason this should not work, but the form > is accepted even with the empty field. Why? Thank you > controller: > def index(): > form=FORM() > if form.accepts(request.vars,session,formname='test'): > response.flash='form accepted' > elif form.errors: > response.flash='form has errors' > else: > response.flash='please fill the form' > return dict() > > view: > {{extend 'layout.html'}} > <form> > <input name='text' type='text'/> > {{=INPUT(_name='prova',_type='text',requires=IS_NOT_EMPTY())}} > <input type='submit'/> > <input type='hidden' name="_formname" value="test"/> > </form>
I've never seen a requires in a View before....even if it didn't work, it's not good MVC separation. I would this into the Model (if always applicable) &/or the Controller (if only appliable sometimes, or using custom forms, as you are): Controller: form=FORM(INPUT(_name='prova',_type='text',requires=IS_NOT_EMPTY())) F --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---