[Zope] two submit buttons/ one method

Geir Bækholt Geir Bækholt <geirh@funcom.com>
Fri, 10 May 2002 09:14:42 +0200


on or about, Thursday, May 09, 2002, we have reason to believe that John Hu=
nter wrote something along the lines of :
[snip]
JH> But I realize that I can process these in the add function, with

JH> if somevar=3D=3D'Update Form':=20
JH>    somevar=3D0
JH> elif somevar=3D=3D'Add Event':
JH>    somevar=3D1
JH> else:
JH>    raise 'Did you change the value of your add form buttons and forget =
to change your add function again=3F'

JH> Not the cleanest design, because if you want to change the text of the
JH> button you have to remember to change your add form, but it should
JH> work.

- This design is slightly flawed , because many people , including
myself , often submit forms by pressing [enter]. In this case ,
neither of the values from the submitbuttins are sent, and your
application will raise 'Did you change .....

you might want to let the else:clause point to one of your options ,
if one can be considered a default..

:-)

--=20
Geir B=E6kholt                      web-developer
geirh@funcom.com             funcom oslo | webdev-team