Hi,
I'm developing an application Turbogears2.2 and I have a lot of form
developed with Toscawidgets2.
Now I want to add a button (cancel) to a form.
I did defined two buttons with the same attribute 'name' and different
'value'.
I did always solved the problem in this manner: same name and specific
value for any button of the form. When I submit the form return the value
of the button clicked and I can active the correct action.
No problems if I not validate. But if I validate the form the 'submit'
element is not mor in the kw dictionary.
Here my code:
""
class CommessaForm(tw2.forms.FormPage):
entity = Commessa
title = 'Commessa'
class child(tw2.forms.TableForm):
allow_extra_fields = True
action = 'commessa_submit'
buttons =
[tw2.forms.SubmitButton(value='Save',name='submit'),tw2.forms.SubmitButton(value='Delete',name='submit')]
...
""
with a lot of fileds omissis, and here the parameters passed to the
'commessa_submit' method in the kw dictionary:
{'cliente_id': u'3', 'display_name': u'', 'data_fine': u'31-10-2013',
'chiusura': False, 'commessa_name': u'Commessa-2013-10-0', 'data_chiusura':
'', 'articolo_id': u'', 'azienda_id': u'1', 'numeropezzi': None,
'importopezzo': u'', 'data_inizio': u'01-10-2013', 'importo':
u'100.000000', 'commessa_id': u'81'}
I did also try to add 'commessaform:' string at the name of the button, to
omogenize the forms names of fileds. But nothing.
But if I look the source of the form all is correct and if I not validate
all the parameters are correctly in the dictionary:
{'commessaform:display_name': u'', 'commessaform:numeropezzi': u'',
'commessaform:data_fine': u'31-10-2013',* 'commessaform:submit': u'Delete'*,
'commessaform:commessa_name': u'Commessa-2013-10-0',
'commessaform:cliente_id': u'3', 'commessaform:articolo_id': u'',
'commessaform:importopezzo': u'', 'commessaform:azienda_id': u'1',
'commessaform:importo': u'100.000000', 'commessaform:data_inizio':
u'01-10-2013', 'commessaform:commessa_id': u'81'}
How can I obtai to distingue the button pressed?
Thanks for help.
Best regards Enrico
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/groups/opt_out.