[Zope] Nested dtml tags
Hi All, How can I do this with dtml? select name=MODLEVEL size=1 dtml-if expr=dtml-var name=MODLEVEL == 1 #I need an alternative to this. option value=1 selected=selected1/option option value=22/option Etc, etc. Hope someone can help. Jon ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Nested dtml tags
Jonathan Bowlas schrieb: Hi All, How can I do this with dtml? select name=MODLEVEL size=1 dtml-if expr=dtml-var name=MODLEVEL == 1 #I need an alternative to this. option value=1 selected=selected1/option option value=22/option Etc, etc. Hope someone can help. No you cant. dtml-var means, unlike the name say really: dtml-print. See it like that and it will be clear. (Or just skip that DTML alltogether) Regards Tino ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Nested dtml tags
--On 20. Juni 2006 12:15:40 +0100 Jonathan Bowlas [EMAIL PROTECTED] wrote: Hi All, How can I do this with dtml? select name=MODLEVEL size=1 dtml-if expr=dtml-var name=MODLEVEL == 1 #I need an alternative to this. option value=1 selected=selected1/option option value=22/option Etc, etc. Hope someone can help. Is there a real need for you to use DTML instead of ZPT? -aj pgpZ9nwtl9AS7.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Nested dtml tags
Hi, no need for nested dtml : select name=MODLEVEL size=1 option value=1dtml-if expr=MODLEVEL == '1' selected/dtml-if1/option option value=2dtml-if expr=MODLEVEL == '2' selected/dtml-if2/option /select On 6/20/06, Jonathan Bowlas [EMAIL PROTECTED] wrote: Hi All, How can I do this with dtml? select name=MODLEVEL size=1 dtml-if expr=dtml-var name=MODLEVEL == 1 #I need an alternative to this. option value=1 selected=selected1/option option value=22/option Etc, etc. Hope someone can help. Jon ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] Nested dtml tags
[EMAIL PROTECTED] On Behalf Of Jonathan Bowlas How can I do this with dtml? select name=MODLEVEL size=1 dtml-if expr=dtml-var name=MODLEVEL == 1 #I need an alternative to this. option value=1 selected=selected1/option option value=22/option Etc, etc. dtml-if MODLEVEL select name=MODLEVEL:int size=1 option value=1 dtml-if expr=MODLEVEL == 1SELECTED/dtml-if 1/option option value=2 dtml-if expr=MODLEVEL == 2SELECTED/dtml-if 2/option Etc, etc. /dtml-if Regards, JL. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] Nested dtml tags
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 This recordset is returned to a dtml form to populate the fields ready for editing. One of the database table entries returned from this query is the value of MODLEVEL, this modlevel can be one of seven choices that appear in a select list. However I'd like the one returned from the database to appear as selected in the form for editing. As far as I can see the example you gave me does not retrieve the value of MODLEVEL from the returned SQL recordset it only checks for its existence and consequently cannot test for the conditions. Any Ideas how I may resolve this? Jon -Original Message- From: Jaroslav Lukesh [mailto:[EMAIL PROTECTED] Sent: 20 June 2006 12:29 To: [EMAIL PROTECTED]; zope@zope.org Subject: RE: [Zope] Nested dtml tags [EMAIL PROTECTED] On Behalf Of Jonathan Bowlas How can I do this with dtml? select name=MODLEVEL size=1 dtml-if expr=dtml-var name=MODLEVEL == 1 #I need an alternative to this. option value=1 selected=selected1/option option value=22/option Etc, etc. dtml-if MODLEVEL select name=MODLEVEL:int size=1 option value=1 dtml-if expr=MODLEVEL == 1SELECTED/dtml-if 1/option option value=2 dtml-if expr=MODLEVEL == 2SELECTED/dtml-if 2/option Etc, etc. /dtml-if Regards, JL. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Nested dtml tags
This is untested, but it's a pretty familiar idiom to me at the moment. dtml-in selectmoduleinfoMethod prefix=dbmodlevel dtml-call REQUEST.set('dbmodlevel', dbmodlevel_item) /dtml-in select name=MODLEVEL dtml-in range(1, 8) prefix=modlevel optiondtml-if expr=modlevel_item == dbmodlevel selected=selected/dtml-ifdtml-var modlevel_item/option /dtml-in /select Cheers, -Andrew - [EMAIL PROTECTED] / http://clearwired.com On Jun 20, 2006, at 6/20/2006 6:51 AMMDT, Jonathan Bowlas wrote: 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 This recordset is returned to a dtml form to populate the fields ready for editing. One of the database table entries returned from this query is the value of MODLEVEL, this modlevel can be one of seven choices that appear in a select list. However I'd like the one returned from the database to appear as selected in the form for editing. As far as I can see the example you gave me does not retrieve the value of MODLEVEL from the returned SQL recordset it only checks for its existence and consequently cannot test for the conditions. Any Ideas how I may resolve this? Jon -Original Message- From: Jaroslav Lukesh [mailto:[EMAIL PROTECTED] Sent: 20 June 2006 12:29 To: [EMAIL PROTECTED]; zope@zope.org Subject: RE: [Zope] Nested dtml tags [EMAIL PROTECTED] On Behalf Of Jonathan Bowlas How can I do this with dtml? select name=MODLEVEL size=1 dtml-if expr=dtml-var name=MODLEVEL == 1 #I need an alternative to this. option value=1 selected=selected1/option option value=22/option Etc, etc. dtml-if MODLEVEL select name=MODLEVEL:int size=1 option value=1 dtml-if expr=MODLEVEL == 1SELECTED/dtml-if 1/option option value=2 dtml-if expr=MODLEVEL == 2SELECTED/dtml-if 2/option Etc, etc. /dtml-if Regards, JL. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
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/modname123/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 ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] Nested dtml tags
Thanks for everyone's help. I may be able to sort this now. -Original Message- From: Tino Wildenhain [mailto:[EMAIL PROTECTED] Sent: 20 June 2006 15:09 To: [EMAIL PROTECTED] 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/modname123/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 ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] nested in tags
Tom Deprez writes: Any experience with using nested in tags with ZSQLMethods? A FAQ. The searchable archive contains at least 5 threads about this theme. If I use nested in-tags iand use the previous-sequence, ... tags (in the inside in-tag) it seems that it looks at the first (outside) in-tag. If I look at the generated url of this previouse-sequence link, it is the url of the outside previous-sequence link. Also, the inner in-tag only displays the last record. What am I doing wrong? Or am I trying something which isn't possible to do? SQL methods do *NOT* look at the DTML namespace, only at the REQUEST object! You must either put your parameters into REQUEST (-- REQUEST.set) or call the SQL method with explicit keyword parameters. Dieter ___ Zope maillist - [EMAIL PROTECTED] 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 )