[Zope] documentation about the ":method"
Martijn Pieters
mj at zopatista.com
Thu Feb 8 08:33:43 EST 2007
On 2/7/07, Andreas Jung <lists at zopyx.com> wrote:
> <http://www.plope.com/Books/2_7Edition/ScriptingZope.stx>
Andreas, that doesn't speak a word about the form-field modifier 'method'.
> > I am looking for some documentation about the ":method" used in some
> > forms, for instance name="discussion_reply:method", but can't find
> > anything.
If the request finds a form field ending in :method in the request,
the id before it is appended to the request URL. This way you can have
multiple callables (scripts, objects, methods, whatever) process the
information from one form, depending on what submit button was
pressed.
It works as follows:
1/ create a form that POSTS to server/path/
2/ use submit buttons named like 'foo:method' and 'bar:method'
3/ Create 'foo' and 'bar' in /path/ (or have them available there
through acquisition or skins)
Now, when a user clicks the 'foo:method' button, Zope receives a form
for server/path/, and modifies the request to go to server/path/foo
instead. If 'bar:method' was pressed, the request ends up at
server/path/bar instead.
HTH,
--
Martijn Pieters
More information about the Zope
mailing list