The view has the following link:
{{=A('Refunded', callback=URL('refund', target='REFUND')}}
<div id="REFUND"></div>
The function 'refund' returns the form, and the idea is that this form can change from the initial form to a confirmation form:
def refund():
form=FORM('Refund:',
INPUT(_name='amount', requires=IS_NOT_EMPTY()),
INPUT(_type='submit'),
_name='form_one')
if form.accepts(request, session, formname='form_one'):
form2 = FORM.confirm('Are you sure to refund $%s?' % (form.vars.amount))
if form2.accepted:
return '%s refunded' % (form.vars.amount)
return form2
return form
On form submit form2 opens up, but on submit form2 the initial form is back (instead of displaying '%s refunded' ).
What would be the way to implement the intended functionality correctly?
I simply need to display form first, and on submit display form2-confirmation, and on form2 submit to do some operation and display the result.