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

Dieter Maurer dieter@handshake.de
Thu, 7 Mar 2002 20:15:25 +0100


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>

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>
	         


Dieter