I'm just beginning my journey into Zopeland so please forgive my ignorance. I'd like to be able to give users a chance to edit records found in a table by selecting the desired record's checkbox and then clicking 'Modify'. This is similar to the Zope management screen. I just don't know how to approach it. I can get Zope to generate a table and form like this from an SQL database. I'm stuck after that. The form only has one 'action' so how would I get it to handle the right function depending on the button that was pushed? I'm no HTML expert but I've looked around quite a bit for an answer and I can't seem to find any info on handling multiple submit buttons. Can Zope make this any easier? (using ZClasses, maybe?) I've also tried searching through the mail archives but I haven't found anything yet. (There are a lot of messages to go through them one at a time.) +---+---------------+---------+------------+ | |Doe |Jane |$100.00 | +---+---------------+---------+------------+ | X |Doe |John |$250.00 | +---+---------------+---------+------------+ | |Haggis |Meister |$100.00 | +---+---------------+---------+------------+ | |Zoper |Doper |$723.00 | +---+---------------+---------+------------+ | +----------+ +----------+ +----------+ | | | ADD | | MODIFY | | DELETE | | | +----------+ +----------+ +----------+ | +------------------------------------------+ thanks, robert
On Mon, 5 Jun 2000, Robert Del Huerto wrote:
database. I'm stuck after that. The form only has one 'action' so how would I get it to handle the right function depending on the button that was pushed? I'm no HTML expert but I've looked around quite a bit for
It can be done with some badly documented magic (see http://www.zope.org/Members/Zen/howto/FormVariableTypes when zope.org is working again :-P) Example: <form action='itdoesntmatter' method=post> <input name=afield> <input type=submit name="delete:method" value=" Delete "> <input type=submit name="modify:method" value=" Modify "> </form> In this example, the action is never called. If the user clicks on the delete button, the method 'delete' (generally in the same folder as this form) is called instead of the action. Similarly, click on Modify and the method called 'modify' is called instead of the action. I'll try to remember to put this up as a tip on zope.org when its possible... -- Stuart Bishop Work: zen@cs.rmit.edu.au Senior Systems Alchemist Play: zen@shangri-la.dropbear.id.au Computer Science, RMIT University
Robert Del Huerto wrote:
+---+---------------+---------+------------+ | |Doe |Jane |$100.00 | +---+---------------+---------+------------+ | X |Doe |John |$250.00 | +---+---------------+---------+------------+ | |Haggis |Meister |$100.00 | +---+---------------+---------+------------+ | |Zoper |Doper |$723.00 | +---+---------------+---------+------------+ | +----------+ +----------+ +----------+ | | | ADD | | MODIFY | | DELETE | | | +----------+ +----------+ +----------+ | +------------------------------------------+
You can have as many action="submit"'s as you want. Untested: <input type="submit" name="add" value="1"> <input type="submit" name="modify" value="1"> <input type="submit" name="delete" value="1"> The form only submits the value of "successfull" form items, so, on your form's action method: <dtml-if add> do your adding thing <dtml-else> <dtml-if modify> do your modifying thing <dtml-else> do your deleting thing </dtml-if> </dtml-if> ~ethan @ digicool
<dtml-if add> do your adding thing <dtml-elif modify> do your modifying thing <dtml-elif delete> do your deleting thing <dtml-else> do your 'Whoa! something ain't right here' thing </dtml-if> ----- Original Message ----- From: ethan mindlace fremen <mindlace@digicool.com> To: Robert Del Huerto <rdh@surfus.net>; <zope@zope.org> Sent: Tuesday, June 06, 2000 2:42 PM Subject: Re: [Zope] detail record editing Robert Del Huerto wrote:
+---+---------------+---------+------------+ | |Doe |Jane |$100.00 | +---+---------------+---------+------------+ | X |Doe |John |$250.00 | +---+---------------+---------+------------+ | |Haggis |Meister |$100.00 | +---+---------------+---------+------------+ | |Zoper |Doper |$723.00 | +---+---------------+---------+------------+ | +----------+ +----------+ +----------+ | | | ADD | | MODIFY | | DELETE | | | +----------+ +----------+ +----------+ | +------------------------------------------+
You can have as many action="submit"'s as you want. Untested: <input type="submit" name="add" value="1"> <input type="submit" name="modify" value="1"> <input type="submit" name="delete" value="1"> The form only submits the value of "successfull" form items, so, on your form's action method: <dtml-if add> do your adding thing <dtml-else> <dtml-if modify> do your modifying thing <dtml-else> do your deleting thing </dtml-if> </dtml-if> ~ethan @ digicool _______________________________________________ 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 (4)
-
ethan mindlace fremen -
Jim Sanford -
Robert Del Huerto -
Stuart 'Zen' Bishop