[web2py] Re: Can't load form using {{=form}} only by {{=LOAD('default','def')}} or submit the form.
Thank you very much, I made a html file called order.load and did what you said and now it's working flawlessly. Cheers for all your help guys. For anyone else stuck on this matter make the default/order.load file or default/form.load then load in html's index as {{=LOAD('default','order.load',ajax=True)}} On Sunday, August 6, 2017 at 12:01:07 PM UTC+1, Paolo Caruccio wrote: > > Do you have a file named "order.load" or "order.html" in views/default > folder? > > LOAD helper needs a view that does not extend the layout. > > Sample of content default order.load (please note the absence of {{extend > 'layout.html'}}): > > {{=order}} > > > More on LOAD helper in > http://web2py.com/books/default/chapter/29/12/components-and-plugins#LOAD > > > > Il giorno venerdì 4 agosto 2017 17:54:05 UTC+2, Samuel Gosling ha scritto: >> >> faced with this! invalid function (default/order) >> >> Started off with that statement you see. >> Really confused at this , seems to be nobody else is having this problem! >> >> On Friday, August 4, 2017 at 3:59:34 PM UTC+1, Jim S wrote: >>> >>> 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', '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.
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.
[web2py] Re: Can't load form using {{=form}} only by {{=LOAD('default','def')}} or submit the form.
faced with this! invalid function (default/order) Started off with that statement you see. Really confused at this , seems to be nobody else is having this problem! On Friday, August 4, 2017 at 3:59:34 PM UTC+1, Jim S wrote: > > 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', '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.
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.
[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.