[Zope-DB] Reference DTML-sqlvar in ZPT?
maciej.wisniowski at coig.katowice.pl
Mon Jul 30 15:35:59 EDT 2007
> I guess my questions are confusing since I am new to Zope. The dtml-sqlvar
> is already defined; the results from the Z SQL Method are already
> presented; I just want to "remind" the user of what they passed to the Z
> SQL Method.
You can't get sql query parameters from it's results. It's like calling
a function. You pass some parameters to it and get results...
> In other words, I only want to print what they selected from a drop-down
> list and passed to the Z SQL Method. I just want to print an already
> defined variable. The problem is: how to print a dtml-sqlvar in ZPT? I
I think you're looking at this from the wrong side ;)
When you submit a form that contains your <select> list, then you have
chosen option at REQUEST object. You may get this with:
and pass it into PageTemplate with results.
For example (may be buggy):
Your form with selection list (PageTemplate):
my_item = context.REQUEST.get('my_item')
results = context.mySQL(my_item=my_item)
return context.resultPageTemplate(my_item=my_item, results=results)
<div tal:define="myitem python: options.get('my_item', 0);
results python: options.get('results', 0)">
You've chosen: <span tal:replace="my_item"></span>
<div tal:repeat="item results" tal:content="item/name"></div>
More information about the Zope-DB