[Zope] two submit buttons/ one method

Geir Bækholt Geir Bækholt
Thu, 9 May 2002 12:27:34 +0200


Hello Harry, 

Thursday, May 9, 2002, 11:55:41 AM, you wrote:

HW> On Thursday 09 May 2002 3:22 am, John Hunter wrote:
>> I have a form with two submit buttons.  Rather than call two different
>> methods as in
>>
>>   <form action="" method="post">
>>     ...
>>     <input type="submit" name="some_func:method" value="Button 1">
>>     <input type="submit" name="some_other_func:method" value="Button 2">
>>   </form>
>>
>> I would like each button to call the same function, but with a
>> different value for a variable.  Something like:
>>
>>   <form action="" method="post">
>>     ...
>>     <input type="hidden" name="somevar" value="someval">
>>     <input type="submit" name="some_func:method" value="Button 1">
>>     <input type="hidden" name="somevar" value="someotherval">
>>     <input type="submit" name="some_func:method" value="Button 2">
>>   </form>
>>
>> But this doesn't work.
>>

the submit buttons count as form-fields as well , so you don't need
the hidden form-fields at all :
<form action="some_func" method="post">

<input type="submit" name="somevar" value="someval" />
<input type="submit" name="somevar" value="someotherval" />
</form>

-- 
Geir Bækholt                       web-developer
geirh@funcom.com             funcom oslo | webdev-team