Some of the information here may be outdated, please check the book instead
[edit]
def form():
    form=FORM(TABLE(TR("Your     name:",INPUT(_type="text",_name="name",requires=IS_NOT_EMPTY())),
                TR("Your email:",INPUT(_type="text",_name="email",requires=IS_EMAIL())),
                TR("Admin",INPUT(_type="checkbox",_name="admin")),
                TR("Sure?",SELECT('yes','no',_name="sure",requires=IS_IN_SET(['yes','no']))),
                TR("Profile",TEXTAREA(_name="profile",value="write something here")),
                TR("",INPUT(_type="submit",_value="SUBMIT"))))
if form.accepts(request.vars,session):
    response.flash="form accepted"
elif form.errors:
    response.flash="form is invalid"
else:
    response.flash="please fill the form"
return dict(form=form,vars=form.vars)
© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by web2py - design derived from a theme by the earlybird
The content of this book is released under the Artistic License 2.0 - Modified content cannot be reproduced.