Dear Massimo,
In the book ref
http://web2py.com/books/default/chapter/29/07#SQLFORM-in-HTML
The "associated "default/display_manual_form.html" view:" now says:
{{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>
Anthony's fix changed the first line. As it now works for me, the whole
thing should be:
{{extend 'layout.html'}}
<form action="#" enctype="multipart/form-data" method="post">
<ul>
<li>Your name is <input name="name" /></li>
</ul>
<input type="submit" />
<input type="hidden" name="_formname" value="test" />
</form>
The above triggers a "form accepted" message and adds an entry to the db.
Thanks for the help, Massimo.
Love and peace,
Joe
On Monday, June 3, 2013 7:09:41 PM UTC-7, Massimo Di Pierro wrote:
>
>
>
> On Monday, 3 June 2013 18:10:20 UTC-5, JoeCodeswell wrote:
>>
>> Here's the link to the post i referenced last time:
>>
>> Manual Form
>> Submission<https://groups.google.com/forum/#!searchin/web2py/manual$20form$20/web2py/7oyt-5KnF04/ZptTnLqFXi4J>
>>
>> Once again, it would be great if the book could get updated to show
>> Anthony's fix.
>>
>
> I am a bit lost. What's the fix? I can update it tomorrow.
>
>
>>
>> Thanks for a great framework.
>>
>> Love and peace,
>>
>> Joe
>>
>> On Monday, June 3, 2013 3:51:37 PM UTC-7, JoeCodeswell wrote:
>>>
>>> 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.