Hi all,
I have this FORM with some fields + paypal fields and paypal action:
form = FORM(
H1("SUBMISSION AND PAYMENT"),
DIV(LABEL("Nome: ",_class="control-label col-sm-3")+DIV(auth.user.first_name,_class="col-sm9"),_class="form-group"),
DIV(LABEL("Cognome: ",_class="control-label col-sm-3")+DIV(auth.user.last_name,_class="col-sm9"),_class="form-group"),
# some others form elements...
# start PAYPAL hidden fields
INPUT(_type="hidden", _name="business", _value="
exa...@email.com"),
INPUT(_type="hidden", _name="cmd", _value="_xclick"),
INPUT(_type="hidden", _name="paymentaction", _value="authorization"),
INPUT(_type="hidden", _name="currency_code", _value="EUR"),
INPUT(_type="hidden", _name="item_name", _value="Name of product"),
INPUT(_type="hidden", _name="amount", _value="10.00")
BUTTON('CONFIRM AND PAY',_value='conferma', _type='submit', _class='btn btn-success btn-lg center-block btn-prenota'),
# THIS IS THE PROBLEM: this action is required to pay, but so form.accepts is not executed
_action="
https://www.paypal.com/cgi-bin/webscr",
_method="post"
)
# ON FORM ACCEPT
if form.accepts(request, session):
date_subscription = datetime.datetime.today()
#insert subscription
db.subscriptions.insert(
user_subscriber =
auth.user.id, #authenticated user
course_id = session.current_course, #current course
course_title = course.title,
course_subtitle = course.subtitle,
subscription_date = date_subscription,
course_date = prenotation_date,
number_of_persons = number_of_persons,
paid = False,
archived = False
)
# OTHER ACTION ON FORM ACCEPT (send emails, ecc...)
There's a way to execute before form.accepts and after redirect to _action url (with _method="post")?
I want before register the subscription, then goto to paypal page.
Thanks!
Fabio