You didn't specify a form method, so I think it defaults to GET, which
means the values will end up in request.get_vars. If you fail to explicitly
specify the "request_vars" argument of SQLFORM.process(), it will
automatically use request.post_vars, but not request.get_vars. So, you
should either do a POST form, via:
<form action="#" enctype="multipart/form-data" method="post">
or pass in the GET variables explicitly:
if form.process(request_vars=request.get_vars, session=None, formname=
'new_order').accepted:
Since you are using the form to add new records, I assume you really want
the former (i.e., do a POST instead of a GET).
Anthony
On Wednesday, May 8, 2013 3:01:10 PM UTC-4, Doug Girard wrote:
>
> I wanted to try and create my own view of a form and still have it submit
> the data to my table... I've got what seems to be a working form etc, but
> when i submit, it appears to do nothing...
>
> Model:
>
> # WORK ORDERS TABLE
> db.define_table('work_order',
> Field('work_date', 'datetime'),
> Field('work_desc', 'text'))
>
>
> Controller:
>
> def manual_new_order():
> form = SQLFORM(db.work_order,onupdate=auth.archive)
> if form.process(session=None, formname='new_order').accepted:
> session.flash = 'form accepted'
> redirect(URL('index'))
> elif form.errors:
> response.flash = 'form has errors'
> else:
> response.flash = 'please fill the form'
> return dict()
>
>
> View:
>
> {{extend 'layout.html'}}
> <h2>Create a new Work Order</h2>
> <p>
> <form>
> <table>
> <tr><td>Work Date: </td><td><input class="datetime" type="datetime"
> name="work_date" /></td></tr>
> <tr><td>Work Description: </td><td><textarea rows="5"
> name="work_desc"></textarea></td></tr>
> </table>
> <input type="hidden" name="order_num" value="{{=int(order.order_num)
> +1}}"/>
> <input type="hidden" name="_formname" value="new_order" />
> <input type="submit"/>
> </form>
> </p>
>
>
> When I submit, I am always getting the 'please fill form' message, telling
> me that it did not process.. Hope I've made myself clear!
>
> Thanks!!
>
--
---
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.