Am Donnerstag, 3. März 2016 16:01:53 UTC+1 schrieb Anthony:
>
> Have you put the form in your view somewhere via {{=form}}?
>
> Note, it doesn't generate a pop-up, just a standard form.
>
> Anthony
>

Hi Anthony!

Thank you for your help.

I'm afraid I don't understand you completly. I have a form, which is in the 
view and which is displayd. I can enter values and the values are stored in 
the db. So far it works fine.
Additionally I want to aks the user if he wants to add some of the added 
data to another table when the user clicks on "save".
As far as I understood, this can be done using form.confirm which will pop 
up a dialog.

The code (as far as I understand it should work):

def client_create():
    db.ck_client.default = request.args(0)
    form = SQLFORM(db.ck_client, keepvalues=True)
    form.add_button('Cancel', URL('clients'))

    if form.process().accepted:

         form_confirm = form.confirm("Do you want to add this to other table?", 
hidden=False)
        if form_confirm.accepted:
            # add to another table


            db.my_table.insert(enabled='True',
                              direction='INCOMING',
                              description=form.vars.description,
                              client_id=form.vars.id,
                              )

        response.flash = 'form accepted'
        redirect(URL('clients'))
    elif form.errors:
        response.flash = 'form has errors'
    return locals()


I don't know if I do not understand how form.confirm should work, if I miss 
something or if this is a bug and, as mentioned, I could not find any 
working example for this. Only massimos hint to:

form = FORM.confirm('Are you sure?')
if form.accepted: do_what_needs_to_be_done()

which doesn't help me any further.



Thank you for helping me, Thorsten
 

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to