Don't use the callback, instead submit the form passing the refound param.
If it exists, return form 2.

On Wed, Dec 4, 2019 at 6:56 AM Vlad <[email protected]> wrote:

> 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.
>
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/6895f84c-43ca-4452-9a79-faa3c17f2837%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/6895f84c-43ca-4452-9a79-faa3c17f2837%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Massimiliano

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CANPTPx%2BNaf%3DNTtMt7vwX_L9E46J1VZ12U8vgmijNT%2BbRss6Jbg%40mail.gmail.com.

Reply via email to