in your code, the form that accepts is form=FORM() and it contains no
fields. No variable is transferred from request.vars to form.vars.
There are no errors because there are no fields.

The {{=INPUT(....)}} is the view get serialized when the form is
displayed but it is not used by accept because it is not part of the
form.

While you can use this syntax to build custom forms, you cannot use
this syntax to process forms.

Massimo

On Jun 17, 5: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
>
> carlo
>
> 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>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to