[Zope] two submit buttons/ one method

Florent Guillaume fg@nuxeo.com
Mon, 13 May 2002 00:10:48 +0000 (UTC)


Please don't do that. It's a maintenance nightmare, an
internationalization nightmare, and an ugly design to boot. Use the
:method idiom, it's designed to that.

Florent

John Hunter  <jdhunter@ace.bsd.uchicago.edu> wrote:
>     Geir> <input type="submit" name="somevar" value="someval" />
>     Geir> <input type="submit" name="somevar" value="someotherval" />
>     Geir> </form>
> 
> Neat idea.  At first I balked because the value is also the text for
> the variable, and I wanted one the button's to say something like
> 
> 'Update Form' with somevar=0
> 'Add event' with somevar=1
> 
> But I realize that I can process these in the add function, with
> 
> if somevar=='Update Form': 
>    somevar=0
> elif somevar=='Add Event':
>    somevar=1
> else:
>    raise 'Did you change the value of your add form buttons and forget to
> change your add function again?'
> 
> Not the cleanest design, because if you want to change the text of the
> button you have to remember to change your add form, but it should
> work.

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com