[Zope] iterate over ZSQL method and make hidden form values...?

Erik Myllymaki erik@pacific-shores.com
Thu, 07 Mar 2002 13:12:31 -0800


Dieter Maurer wrote:

> Erik Myllymaki writes:
>  > I have a form that collects about 15 values, and a ZSQL method that 
>  > collects about 15 values on the same page. I want to amalgamate them 
>  > together and push them through to the next page where I could then use 
>  > them all easily in another ZSQL method by just passing REQUEST.
>  > 
>  > (note, I am using ZODBCDA so zsql_result.dictionaires() is unavailable 
>  > to me!).
>  > 
>  > Something like this(but that actually works ;-)):
>  > 
>  > <form>
>  > <dtml-in zsql_method>
>  >    <dtml-in sequence-item>
> What should that do?
> 
>   "sequence-item" is here a "Record" object not a sequence.
> 
>  >      <input type="hidden" name="<dtml-var sequence-item-name>" 
> What's "sequence-item-name" (and "sequence-item-value").
> Seems, you want some background reading on "dtml-in" variables.
> I can suggest the "DTML" section of
> 
>   <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>


Yes, I realize these are not legit variables, I was just trying to show 
an example of what I need without knowing ALL the methods or variable 
names avaiable to me.


> Said, that I do not understand what you want to do with your inner
> "dtml-in", I can help you to work around the missing "dictionaries":
> 
> 	   <dtml-let results=zsql_method
> 	             columns="results.names()"
> 	   >
>               <!-- results now contains the result sequence, columns
> 	           the column names -->
> 	      <dtml-in results>
> 	        <dtml-in columns prefix=col_>
> 		  <dtml-var col_item> <!-- this is the column name-->
> 		  <dtml-var expr="_[col_item]"> <!-- this is your column value.
> 		                                     provided there is no
> 						     name clash -->
>                </dtml-in>
> 	     </dtml-in>
> 	   </dtml-let>


Thanks, this is what I was after. I ended up using an external method to 
provide the dictionaries() function, but being able to do it right in 
DTML is handy.



-- 
--

Erik Myllymaki
erik@pacific-shores.com