[Zope] Detecting which form button is pushed?

Petru Paler ppetru@coltronix.com
Sun, 20 Feb 2000 16:07:23 +0200


On Mon, Feb 21, 2000 at 12:33:13AM +1100, Brett Morgan wrote:
> ...
> <input type="SUBMIT" name="create" value="Create As New Record (Copy)">
> <input type="SUBMIT" name="edit" value="Edit In Place">
> <input type="SUBMIT" name="delete" value="Delete This Record">
> ...
> 
> And I would like to know what is the correct way of munging
> REQUEST.form to switch on which was pressed. 
> 
> Also is there a way of <dtml-if>'ing on the existance of a variable in
> the namespace? I sometimes want the logical control similar to the
> &dtml.missing-variable; entity def.

<dtml-if "_.hasattr(REQUEST, 'create')">
    (user pushed create)
<dtml-elif "_.hasattr(REQUEST, 'edit')">
    (user pushed edit)
<dtml-else "_.hasattr(REQUEST, 'delete')">
    (user pushed delete)
</dtml-if>

(untested, YMMV of course)

-Petru