Re: [web2py] Can't load form using {{=form}} only by {{=LOAD('default','def')}} or submit the form.
Then I think I completely misunderstood your problem and what your goal is. What is it you're trying to do? Where is your present template? If you mean that you want the template file named index.html, then you can simply rename my order.html file and change the name in the controller code. -Jim On Saturday, August 5, 2017 at 10:54:02 PM UTC-5, Samuel Gosling wrote: > > Yes that works! Thank you! But it only focuses on my form not my template. > How can i contain it as a form on my present template as I am doing with > the LOAD function, because I want this form to show up in index.html that's > where it won't load. > > On Friday, August 4, 2017 at 5:15:17 PM UTC+1, Jim S wrote: >> >> Your db.py is fine. >> >> default.py should contain: >> def order(): >> response.view = 'default/order.html' >> 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 dict(order=order) >> >> >> order.html should be: >> >> {{extend 'layout.html'}} >> {{=order}} >> >> >> Tested on my system and works as expected. >> >> -Jim >> >> >> On Friday, August 4, 2017 at 10:51:30 AM UTC-5, Samuel Gosling wrote: >>> >>> I declared that that didn't work unfortunately, if you read my text >>> properly. Appreciate the suggestions nonetheless! >>> >>> On Friday, August 4, 2017 at 3:52:56 PM UTC+1, Áureo Dias Neto wrote: Your 'form' is in the variable order, here: order = SQLFORM(db.order,... use {{=order}} in the view >>> -- 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.
Re: [web2py] Can't load form using {{=form}} only by {{=LOAD('default','def')}} or submit the form.
Yes that works , but it only focuses on my form not my template. How can i contain it as a form on my present template as I am doing with the LOAD function. On Friday, August 4, 2017 at 5:15:17 PM UTC+1, Jim S wrote: > > Your db.py is fine. > > default.py should contain: > def order(): > response.view = 'default/order.html' > 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 dict(order=order) > > > order.html should be: > > {{extend 'layout.html'}} > {{=order}} > > > Tested on my system and works as expected. > > -Jim > > > On Friday, August 4, 2017 at 10:51:30 AM UTC-5, Samuel Gosling wrote: >> >> I declared that that didn't work unfortunately, if you read my text >> properly. Appreciate the suggestions nonetheless! >> >> On Friday, August 4, 2017 at 3:52:56 PM UTC+1, Áureo Dias Neto wrote: >>> >>> Your 'form' is in the variable order, here: order = >>> SQLFORM(db.order,... >>> >>> use {{=order}} in the view >>> >> -- 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.
Re: [web2py] Can't load form using {{=form}} only by {{=LOAD('default','def')}} or submit the form.
Your db.py is fine. default.py should contain: def order(): response.view = 'default/order.html' 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 dict(order=order) order.html should be: {{extend 'layout.html'}} {{=order}} Tested on my system and works as expected. -Jim On Friday, August 4, 2017 at 10:51:30 AM UTC-5, Samuel Gosling wrote: > > I declared that that didn't work unfortunately, if you read my text > properly. Appreciate the suggestions nonetheless! > > On Friday, August 4, 2017 at 3:52:56 PM UTC+1, Áureo Dias Neto wrote: >> >> Your 'form' is in the variable order, here: order = SQLFORM(db.order,... >> >> use {{=order}} in the view >> > -- 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.
Re: [web2py] Can't load form using {{=form}} only by {{=LOAD('default','def')}} or submit the form.
I declared that that didn't work if you read my text properly! On Friday, August 4, 2017 at 3:52:56 PM UTC+1, Áureo Dias Neto wrote: > > Your 'form' is in the variable order, here: order = SQLFORM(db.order,... > > use {{=order}} in the view > -- 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.
Re: [web2py] Can't load form using {{=form}} only by {{=LOAD('default','def')}} or submit the form.
Your 'form' is in the variable order, here: order = SQLFORM(db.order,... use {{=order}} in the view -- 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.
[web2py] Can't load form using {{=form}} only by {{=LOAD('default','def')}} or submit the form.
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', '1 ɌDD'])), Field('address', requires=IS_NOT_EMPTY())) index.html {{=LOAD('default','order')}} -- 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.