[Zope-Annce] [Patch] supports ":method" suffix for <input type=image> form elements
supports ":last", retain only last given value
supports ":last", retain only last given value
Dieter Maurer
dieter@handshake.de
Sun, 30 Jul 2000 20:50:04 +0200
Do you like
* buttons containing images (and do not yet want to use the
HTML 4.0 "button" tag)
and
* Zope's ":method" magic for buttons?
The you may find the following patch interesting:
URL:http://www.dieter.handshake.de/pyprojects/zope/imgbutton.pat
With the current Zope, you can not use ":method" with
"<input type=image>" tags, i.e. the HTML 3.2 image buttons.
The browser creates for such an image button two form
variables "<name>.x" and "<name>.y". These suffixes (".x" and ".y")
prevent Zope to recognize any type suffix, especially ":method".
The patch above extends Zope's ":method" suffix handling for
the case of image buttons.
It defines for them the form variable "imgclickpos", a record with
the 2 integer fields "x" and "y", and calls the method
as it does for normal submit buttons.
The patch defines a new ":last" suffix, too.
"<name>:last" tells Zope to discard any value previously
seen for "<name>".
This should avoid the nasty case to get a single
value, if a form contains a field once, but a list if it
contains the list several times.
"<name>:last" ensures, you always get a single value (and
not a list), namely the last one.
":last" is effective only for types that are not
SEQUENCE, RECORD nor RECORDS.
For ":list" and ":tuple", ":last" is not senseful.
For ":record" and ":records", the code was rather complicated,
such that I not dared to change it.
Dieter