Image Submit Buttons
I have a form where, instead of "Add" and "Delete" buttons, I want to use images of a plus and a minus sign. If I use images, Zope seems to ignore the names and values of buttons. For example: I have something that looks like this: Form Html: <form action="edit" method="post"> <input type="submit" name="mode" value="Add"> <input type="submit" name="mode" value="Delet"> </form> DTML Method "edit": <dtml-if "mode == 'Add'"> .... <dtml-elseif "mode == 'Delete'"> .... </dtml-if> Works great, but if I change the form to: <form action="edit" method="post"> <input type="image" src="..." name="mode" value="Add"> <input type="image" src="..." name="mode" value="Delet"> </form> Zope responds: "Zope Error Zope has encountered an error while publishing this resource. Error Type: NameError Error Value: mode" Anybody have any suggestions? ,------------------------------------------------------------, | Weston J. Bustraan | E-Mail: weston@itdonline.net | | Development Manager | Phone: (616)249-3630 | | Infinity Tel-Data Inc. | Fax: (616)249-3067 | | 4723 S. Division Ave. | WWW: www.itdonline.net | | Wyoming, MI 49548 | PGP: finger weston@itdonline.net | `------------------------------------------------------------` A)bort, R)etry, I)nfluence with large hammer.
I have a form where, instead of "Add" and "Delete" buttons, I want to use images of a plus and a minus sign. If I use images, Zope seems to ignore the names and values of buttons.
This actually isn't a problem with Zope; it's how the Image type is interpreted. The "value" tag has no meaning for Images. What you want is this: <input type=image src="add.gif" name="add"> <input type=image src="delete.gif" name="delete"> Then when you click on the add button, you'll get these two values in your REQUEST space: add.x add.y So, to check for which button you've pressed, you'll have to do: <dtml-if "REQUEST.has_key('add.y')"> ... <dtml-elif "REQUEST.has_key('delete.x')"> ... </dtml-if> That's just how forms work, nothing Zope specific. :) Hope that helps, CJ
hello use this as html <form action="edit" method="post"> <input type="image" src="..." name="add"> <input type="image" src="..." name="delete"> </form> in zope the variables are called add.x (or add.y) and delete.x depending which image you push. greetings andreas On Thu, 13 Apr 2000, Weston Bustraan wrote:
I have a form where, instead of "Add" and "Delete" buttons, I want to use images of a plus and a minus sign. If I use images, Zope seems to ignore the names and values of buttons.
For example:
I have something that looks like this:
Form Html: <form action="edit" method="post"> <input type="submit" name="mode" value="Add"> <input type="submit" name="mode" value="Delet"> </form>
DTML Method "edit": <dtml-if "mode == 'Add'"> .... <dtml-elseif "mode == 'Delete'"> .... </dtml-if>
Works great, but if I change the form to:
<form action="edit" method="post"> <input type="image" src="..." name="mode" value="Add"> <input type="image" src="..." name="mode" value="Delet"> </form>
Zope responds: "Zope Error Zope has encountered an error while publishing this resource. Error Type: NameError Error Value: mode"
Anybody have any suggestions?
,------------------------------------------------------------, | Weston J. Bustraan | E-Mail: weston@itdonline.net | | Development Manager | Phone: (616)249-3630 | | Infinity Tel-Data Inc. | Fax: (616)249-3067 | | 4723 S. Division Ave. | WWW: www.itdonline.net | | Wyoming, MI 49548 | PGP: finger weston@itdonline.net | `------------------------------------------------------------`
A)bort, R)etry, I)nfluence with large hammer.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Andreas Mutschlechner -
Christopher J. Kucera -
Weston Bustraan