RE: [Zope] dtml-in question
I would suggest flattening your loop, like this: <form action="myaction"> <table> <dtml-in expr="_.range(100)"> <dtml-if expr="_['sequence-index'] % 10 == 0"> <dtml-unless sequence-start> </tr> </dtml-unless> <tr> </dtml-if> <td><input type="text" name="box:list" size="3"></td> </dtml-in> </tr> </table> </form> This will create 100 (or any number) of input boxes. It's also easier to change how many boxes you want per line, just change the 10 in the if statement. You can also more easily support a total number of boxes that isn't a multiple of your row length. By naming the input boxes "box:list", a single sequence named box will be passed to your method "myaction". This will probably be easier than 100 different names. -Randy
-----Original Message----- From: Russell Hires [mailto:rhires@earthlink.net] Sent: Tuesday, April 03, 2001 10:14 AM To: Phil Harris Cc: zope@zope.org Subject: Re: [Zope] dtml-in question
Why of course!
I want to create a table of input boxes. The way I wanted to do this was by creating a row of boxes, then going to the next row and creating ten more boxes.
In the course of writing this, I couldn't remember what I had originally done that didn't work. But in trying to duplicate it, it does work now:
<table> <dtml-in "_.range(10)"> <tr> <dtml-in "_.range(10)"> <td><form> <input type=text name="foo" size=3> </dtml-in> </dtml-in> </table>
Of course, at this point, using this code, I have 100 input boxes with the same name. How do I introduce a counter that will give me 100 different names for the boxes (or whatever number of boxes the user wants to create)?
Thanks for your help.
Russell ____________________________________________________ _its_ (no apostrophe) means "the thing that it owns" _it's_ (with apostrophe) means "it is"
----------
From: "Phil Harris" <phil.harris@zope.co.uk> To: "Russell Hires" <rhires@earthlink.net>, <zope@zope.org> Subject: Re: [Zope] dtml-in question Date: Tue, Apr 3, 2001, 10:17 AM
Nesting dtml-in is very possible.
I don't quite get from your explanation what your trying to do though.
Could you elucidate slightly.
Phil
----- Original Message ----- From: "Russell Hires" <rhires@earthlink.net> To: <zope@zope.org> Sent: Tuesday, April 03, 2001 3:08 PM Subject: [Zope] dtml-in question
Is it possible to nest <dtml-in> tags? Actually, I know it isn't because that's something I've tried already and it didn't work. At least, it didn't work the way I tried it.
I'm just getting my feet wet with dtml, and I created a table using one dtml method to create one row of the table using the <dtml-in> tag, but it seems silly to have to have a completely separate method for one <tr> tag in a method all by itself.
I did solve the problem this way: I created one method with the definition of one row of a table, then created another method with one <tr> tag to create the next row of the table, then looped using <dtml-in> first-method second-method</dtml-in>. It just seems kinda klunky...
Thanks for any help!
Russell
_______________________________________________ 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 (1)
-
Randall F. Kern