Dear web2py-users,
How can I get the SQLFORM in HTML example in book 5th Edition to work?
As far as i can tell i have copied the example VERBATIM.
In controllers/default.py :
def display_manual_form():
form = SQLFORM(db.person)
if form.process(session=None, formname='test').accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill the form'
# Note: no form instance is passed to the view
return dict()
In models/5_appointment.py :
# for testing display_manual_form
db.define_table('person',
Field('name','string'),
)
in default/display_manual_form.html :
#default/display_manual_form.html
{{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>
The behavior is the same as reported in this group
here<https://groups.google.com/forum/#%21searchin/web2py/%22sqlform$20in$20html%22/web2py/PBPf_B_J_8U/d64xohhcUW8J>
, even though the example adds "session=None to the call to .process()", i.e.
:
> Its not validating the form, just flashing "fill the form" message.
Also, no entry gets added to the database.
Thanks for the help in advance.
Love and peace,
Joe
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.