I had to separate the payment methods to different pages than all in one. So a user selects a button and gets redirected to the subsequent subscription type. Previously i handled all payments in one function def pay(): subscr_one ...process subscr_one subscr_three ...process subscr_three subscr_six ...process subscr_six but each subscription has its own function now: def subscr_one(): ...process subscr_one def subscr_three(): ...process subscr_three def subscr_six(): ...process subscr_six
On Wednesday, December 23, 2020 at 2:57:03 PM UTC+3 Annet wrote: > I am not sure I fully understand your question, but doesn't SQLFORM. > widgets.radio.widget > on the pay_with solve your issue? > > Best, > > Annet > > Op dinsdag 22 december 2020 om 17:25:57 UTC+1 schreef mauri...@gmail.com: > >> I worked on a way to pay through various methods. It involves a user >> selecting the appropriate method he/she likes or wants to use. >> >> This is the code: >> #Controller >> >> form = SQLFORM(Pending, formstyle="divs", submit_button='Subscribe'), >> if form.process().accepted: >> session.pending = form.vars >> redirect(URL('e_pay', form.vars.pay_with, )) >> >> form_one = SQLFORM(Subscription_one, formstyle="divs", >> submit_button='Subscribe') >> if form_one.process().accepted: >> session.pending_one = form_one.vars >> redirect(URL('e_pay', form_one.vars.pay_with, )) >> >> #db.py >> one_month = timedelta(days=365/12) >> Subscription_one = db.define_table('subscription_one', >> Field('user_id', 'reference auth_user'), >> Field('Subscription_type','text', default >> = 'One Month', represent = lambda value, row: >> DIV(str(value),_style="color:#38D9D6; text-align: center;")),#Only modified >> by Admin >> Field('Amount','double', default= 3.49, >> represent = lambda value, row: DIV('$' + str(value) + '/month', >> _style='text-align: center; color: red; font-size: 30px;')),#Only modified >> by Admin >> >> Field('pay_with',requires=IS_IN_SET((['paypal','stripe',])),default='None'), >> Field('confirmed', 'boolean', >> default=False), >> Field('start_date', 'date', >> default=request.now), >> Field('renew_date', 'date', >> default=request.now+one_month),) >> three_month = timedelta(days=365/4) >> Subscription_three = db.define_table('subscription_three', >> Field('user_id', 'reference auth_user'), >> Field('Subscription_type','text', default >> = 'Three Months', represent = lambda value, row: >> DIV(str(value),_style="color:#38D9D6; text-align: center;")),#Only modified >> by Admin >> Field('Amount','double', default= 3.29, >> represent = lambda value, row: DIV('$' + str(value) + '/month', >> _style='text-align: center; color: red; font-size: 30px;')),#Only modified >> by Adminn >> >> Field('pay_with',requires=IS_IN_SET((['paypal','stripe',])),default='None'), >> Field('confirmed', 'boolean', >> default=False), >> Field('start_date', 'date', >> default=request.now), >> Field('renew_date', 'date', >> default=request.now+three_month),) >> >> The problem is that the user when selecting an option, 'paypal' and >> decides against it and selects 'stripe', the options are still 'active' and >> not deselected.So on clicking submit, both might be posted. >> How can I prevent both selections at the same time? >> I also need to align the buttons to the center or left but >> _select='align-items:center' is not working. >> Kind regards >> > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/64cca914-00dc-4d5d-9663-82092641d712n%40googlegroups.com.