In your controller, try:

return dict(order=order)

instead of:

return order

-Jim

On Friday, August 4, 2017 at 9:45:51 AM UTC-5, Samuel Gosling wrote:
>
> Hey guys completely new to web development and web2py , enjoying it so 
> far. It has a lot of potential.
>
> Need help loading my form in my index.html as I can't using {{=form}} or 
> in this case {{=order}} only by using the command 
> {{=LOAD('default','order')}}. I believe this may be my problem in 
> submitting the form also as I keep getting my error back and the page won't 
> redirect.
> I know usually for using a form you use the {{=form.custom.begin}} , 
> {{=form.custom.submit}}  and {{=form.custom.end}} but since I can't use 
> {{=form} that isn't an option. If i use {{=form}} , I get the error that it 
> is not defined. I have looked for answers but they resulted to no avail. 
>  Hope you guys can help and I appreciate it greatly. 
>
> default.py
> def order():
>     order = SQLFORM(db.order,
>                    submit_button='Buy!',
>                    buttons=['submit'],
>     formstyle='table3cols')
>     if order.process(keepvalues=True).accepted:
>         session.flash = 'Order submitted.'
>         redirect(URL('payment'))
>     elif order.errors:
>         session.flash = 'Error.'
>     else:
>         session.flash = 'Please enter a wallet address.'
>     return order
>
> db.py
> db = DAL('sqlite://storage.sqlite')
> db.define_table('order', Field('amount', requires=IS_IN_SET(['100 ɌDD', 
> '250 ɌDD', '500 ɌDD' , '1000 ɌDD', '2500 ɌDD', '5000 ɌDD', '10000 ɌDD'])),
> Field('address', requires=IS_NOT_EMPTY()))
>
> index.html
> <div class="order_form">
>     {{=LOAD('default','order')}}
> </div>
>
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to