[Zope] multiple SUBMIT buttons for same method, with
parameter
Amos Latteier
amos@aracnet.com
Mon, 05 Apr 1999 10:18:40 -0700
At 05:18 PM 3/31/99 +1000, Piers Lauder wrote:
>I can use the following in a DTML document to call a specific method:
>
> <INPUT TYPE="submit" NAME="mymethod:method" VALUE="Delete this item">
>
>But what if I wanted to have lots of them?
>
>I'd like to have multiple SUBMIT buttons, all referring to the same method
>but diffentiated by parameter - possible?
>
>Ie: something like:
>
> <INPUT TYPE="submit" NAME="mymethod:1:method" VALUE="Delete item 1">
>
>passing the parameter '1' to 'mymethod', and then later
>
> <INPUT TYPE="submit" NAME="mymethod:2:method" VALUE="Delete item 2">
Well, why not just use normal form elements:
<form action="myMethod">
...
<input type="submit" name="myParameter" value="1">
<input type="submit" name="myParameter" value="2">
<input type="submit" name="myParameter" value="3">
...
</form>
If you don't want to use the value attribute of the input tag since it is
displayed by the browser, you can name each submit element differently and
test for its existence, rather than its value.
<form action="myMethod">
...
<input type="submit" name="myParameter1" value="Blah blah blah">
<input type="submit" name="myParameter2" value="Blah blah blah">
<input type="submit" name="myParameter3" value="Blah blah blah">
...
</form>
>Incidentally, is the ':method' trick documented? - I can't find it in
>the DTML guide.
Hmm, I know it's documented somewhere. However, I can't find it in the DTML
Guide :-( I'll try to make sure that it gets in the next revision of the
DTML Guide.
-Amos