[Fwd: Re: [Zope] Detecting which form button is pushed?]
-------- Original Message -------- Subject: Re: [Zope] Detecting which form button is pushed? Date: Sun, 20 Feb 2000 19:11:13 -0800 From: Michel Pelletier <michel@digicool.com> To: Hung Jung Lu <hungjunglu@hotmail.com> CC: lstaffor@dynalogic.com, brett@pulse.itd.uts.edu.au References: <20000220180227.26691.qmail@hotmail.com> Hung Jung Lu wrote:
From: "Loren Stafford" <lstaffor@dynalogic.com> I don't know much about it, because I've never used it, but there Zope supports a ":method" type that you can but on form variables or on button names. Then Zope concatenates the name with the "action" value to create an action unique to the button.
You'll have to search around for the details. Hope that helps.
That helps a whole world. :) Thanks! It works exactly the way you have described.
I keep running into this kind of JavaScript tricks... arghhh... those "...:..." tags. Now I know there are "mySelection:list", "myMethod:method", "myVar:int", etc. These kinds of little tiny patches makes JavaScript look like Perl. :)
This isn't javascript, this is all Zope. What Loren was explaining was a qualifier for ZPublisher's type marshaling mechanism. For example, in a form you can have: <input name="bob:int"> And ZPublisher will marshal the value from this input into a python integer (if it can, if it can't, it raises an error). 'method' is another qualifier that can be used, and it's a bit magical. Suppose you had a Folder called 'foo' with three DTML Methods in them called 'A', 'B', and 'C'. In an HTML form you could have the following code: <form action="URLtoFolder" method="POST"> <input type="submit" name="A:method" value="This will call A"> <input type="submit" name="B:method" value="This will call B"> <input type="submit" name="C:method" value="This will call C"> </form> Pressing a different button each time will call a different method. This is also quite a bit more graceful and flexible than a bunch of <dtml-if> statements to determine which button was pressed. -Michel
participants (1)
-
Michel Pelletier