HI
I have a form with multiple submit buttons. It works.

But to me it seems like a kludge. Is there a better way?

Here is the controller where dictlist is just a list of dictionaries with 
'name' and 'id'
So the part that seems kludgey to me is checking which button was pressed. 
I do it by testing which of the buttons has the "Working..." value that is 
the default web2py behaviour


    buttons = []
      for d in dictlist:
        a = DIV( INPUT(_name = d['id'], _value = d['name'], _type = 
'submit'\
                , _class = "btn btn-outline-primary") )
        buttons.append(a)

    form = SQLFORM.factory(buttons = buttons)

    if form.process().accepted:
        for keys in form.vars:
            # "working" is the web2py default text shown on the button 
after press
            if name_form.vars[keys][0:4] == "Work":  
               redirect(URL('temp', vars=dict(who = keys) ))
               break


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

Reply via email to