Newbie Question: Create Table Interface
I'm new to Zope and I have the following problem: I want to create a interface for creating tables (if there isn't one already). The layout of the form would be similar to the form where you add properties for objects in Zope. Instead of properties there would be a list of columns and there types and below that you can type in a new column name and it's type and add it to the list. After you have defined the table structure you submit the form and the table is created. The columnlist is not a persistant list however. Question1: How do you then define a list variable in the dtml document that is only used while busy with the form? Question2: If I add a column to the list, how do I tell Zope to render the same dtml document and update the list? Thanks for your help. Roché
On Tue, 17 Aug 1999, [iso-8859-1] Roch� Compaan wrote:
I want to create a interface for creating tables (if there isn't one already). The layout of the form would be similar to the form where you add properties for objects in Zope.
Check out the ZTables contributed product on the Download page.
Question1: How do you then define a list variable in the dtml document that is only used while busy with the form?
Use <dtml-var "REQUEST.set('name', '[]')"--> and <dtml-var "_['name'][index] = value"-->. There is explict support for lists in forms but cannot recall it currently.
Question2: If I add a column to the list, how do I tell Zope to render the same dtml document and update the list?
On your form, set the target in your action button to point to the same page and unpack the new list from REQUEST.forms and rebuild the page. Esstentially, the user adds stuff to a form, the "Submit" reloads the same page with the new data via a query string. Zope then uses the new data (prehapes with if statements) to rebuild the page.
Thanks for your help. Roch�
Cheers, Anthony Pfrunder
ross-@med.usyd.edu.au wrote: AFAIK, DC hasn't made ztables available as open source - I seem to remember that you can buy it. There are tinytables but no ztables in the unsupported or the contributed software areas. Or am I missing Something Really Usefull again ? original article:http://www.egroups.com/group/zope/?start=9909
On Tue, 17 Aug 1999, [iso-8859-1] Roché Compaan wrote:
I want to create a interface for creating tables (if there isn't one already). The layout of the form would be similar to the form where you add properties for objects in Zope.
Check out the ZTables contributed product on the Download page. Cheers, Anthony Pfrunder
Question1: How do you then define a list variable in the dtml document that is only used while busy with the form?
Use <dtml-var "REQUEST.set('name', '[]')"--> and <dtml-var "_['name'][index] = value"-->. There is explict support for lists in forms but cannot recall it currently.
I'm still lost here. Say for instance if have a list variable "tablestructure" which contains pairs of "column" and "type". I want to add to "tablestructure" by dtml along the lines of: <form action="<!--#var URL1-->/manage_addcolumn" method="POST"> <p> To add a new column, enter the column name and type and click the "Add" button. </p> <table> <tr> <th align="left" valign="top">Column</th> <td align="left" valign="top"><input type="text" name="column" size="20"></td> <th align="left" valign="top">Type</th> <td align="left" valign="top"> <select name="type"> ... I want to pass the "column" and it's "type" to the method "manage_addcolumn". Q: Do i call <dtml-var "REQUEST.set('name', '[]')"--> in the addcolumn method or how must i go about. how do i enter "column" and "type" in the "tablestructure" list. roché thanks for the pointers.
participants (3)
-
Anthony Pfrunder -
Roché Compaan -
rossl@med.usyd.edu.au