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/1dabed34-4d7a-4dea-a1f5-8cb37909fa55n%40googlegroups.com.

Reply via email to