Thanks for everyone's help. I may be able to sort this now. -----Original Message----- From: Tino Wildenhain [mailto:tino@wildenhain.de] Sent: 20 June 2006 15:09 To: me@jonbowlas.com Cc: 'Jaroslav Lukesh'; zope@zope.org Subject: Re: [Zope] Nested dtml tags Jonathan Bowlas schrieb:
Hmm, this doesn't appear to work.
Let me explain what I'm trying to do.
I have a Z SQL Method called selectmoduleinfoMethod that contains the SQL:
SELECT * FROM RECMGR_EL_MODULE_Query WHERE MODCODE = <dtml-sqlvar MODCODE type="string">
You should never use SELECT * in production code. Better state the name of the columns you really want there. (Thus fixing their name) One simple form would be: SELECT modlevel,modname,modlevel=<dtml-sqlvar modlevel> as selected FROM foobar WHERE modcode = <dtml-sqlvar modcode type=string> ... Then you could use the result of your ZSQL Method more or less directly, in ZPT for example: <select name="MODLEVEL"> (size="1" is default anyway ;) <option tal:repeat="mod here/yourZSQLMethod" tal:attributes="value mod/modlevel; selected mod/selected" tal:content="mod/modname">123</option> </select> In Python Script, it should work like this: MODLEVEL=request.form.get('MODLEVEL','') # make sure you get the types correctly return [dict(x,selected=x.modlevel==MODLEVEL) for x in context.selectmoduleinfoMethod()] this works with your ZSQL method as it is (more or less - adjust the column names) and can be used like the one above. If you like ugly templates and a lot of writing you can translate the example to DTML - this is left to the reader ;) Regards Tino