• 1148 views
  • 0 comments
  • loading...

FORM is one of the most important helpers

In its simple form, it just makes a <form>...</form> tag, but because helpers are objects and have knowledge of what they contain, they can process submitted forms (for example, perform validation of the fields). 

The "enctype" is "multipart/form-data" by default.



>>> print FORM(INPUT(_type='submit'), _action='', _method='post')

<
form enctype="multipart/form-data" action="" method="post">
<
input type="submit" /></form>

Attributes / Arguments

The constructor of a FORM, and of SQLFORM, can also take a special argument called hidden. When a dictionary is passed as hidden, its items are translated into "hidden" INPUT fields. For example:

>>> print FORM(hidden=dict(a='b'))
<form enctype="multipart/form-data" action="" method="post">
<input value="b" type="hidden" name="a" /></form>


Examples

loading...

Sources / Reference

" web2py Book Chapter 5: The views" is licensed under Creative Common License BY-NC-ND 3.0


Comments

loading...

Powered by
Web2py

Hosted on
www.pythonanywhere.com
(affiliated link)