[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Advanced Zope Scripting

webmaster@zope.org webmaster@zope.org
Thu, 26 Sep 2002 18:39:03 -0400

A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/ScriptingZope.stx#3-54


      Here's an example form that uses action converters::

        <form action="">

        <p>Select one or more employees</p>

        <input type="checkbox" name="employees:list" value="Larry"> Larry<br>
        <input type="checkbox" name="employees:list" value="Simon"> Simon<br>
        <input type="checkbox" name="employees:list" value="Rene"> Rene<br>

        <input type="submit" name="fireEmployees:action"

        <input type="submit" name="promoteEmployees:action"


        % Anonymous User - Apr. 11, 2002 5:03 pm:
         What about changing the target as well as the action for different submit buttons? For example, one submit
         goes to a frame, a different submit goes to a new window.

        % Anonymous User - May 6, 2002 10:17 am:
         Note also this <form action=""> line.
         If you'll write <form action="some_script">, then submit button will produce "some_script/fireEmployee" or
         "some_script/promoteEmployee" calls.

        % Anonymous User - May 7, 2002 3:11 am:
         Target attribute is handled by browser when submitting form, so it's not really possible to alter it on a
         server after the form was submitted -- the server's response will go where it would go, but if you load back
         the same form with some JavaScript (which would load something into other frame) implanted, you may pretend
         you altered the target. Pretty dirty hack though...

        % Anonymous User - May 7, 2002 7:25 am:
         I tried Konqueror, Netscape and MSIE browsers and it works only if I put 
         <form action=".">

         (I put the form in a ZPT, and it works both if scripts return simple data or 
         recall the same ZPT)

        % Anonymous User - July 18, 2002 8:46 pm:
         this is dirty, but

         <form action="" name="employeeForm">


         <input type="submit" name="fireEmployees:action" value="Fire!"
         onClick="document.forms['employeeForm'].target='_blank'"><br> (opens in new window)
         <input type="submit" name="promoteEmployees:action" value="Promote!"
         onClick="document.forms['employeeForm'].target='_self'"> (opens in same window)

        % Anonymous User - Aug. 22, 2002 10:47 am:
         Ok, I understand how :action can be used. But how about default_action ? From what I tried, the <form
         action=""> has to be empty for :action to work (maybe good to mention here explicitly). So how can there be a
         default_action ? It would be most logical <form action="some-action"> would be default ?

        % Anonymous User - Sep. 26, 2002 6:39 pm:
         i learned zope with a modifier of "method". something changed? blf