[Zope] Nested dtml tags

Andrew Hedges andrew at clearwired.com
Tue Jun 20 10:03:08 EDT 2006


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">
     <option<dtml-if expr="modlevel_item == dbmodlevel">  
selected="selected"</dtml-if>><dtml-var modlevel_item></option>
</dtml-in>
</select>

Cheers,
-Andrew
-----
andrew at clearwired.com / 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:lukesh at seznam.cz]
> Sent: 20 June 2006 12:29
> To: me at jonbowlas.com; zope at zope.org
> Subject: RE: [Zope] Nested dtml tags
>
>> bounces+lsh=wo.cz at zope.org] 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="selected">1</option>
>> 		<option value="2"><2</option>
>> 		Etc, etc.
>
>
>
>
> <dtml-if MODLEVEL>
> 	<select name="MODLEVEL:int" size="1">
> 		<option value="1" <dtml-if expr="MODLEVEL ==
> 1">SELECTED</dtml-if> >1</option>
> 		<option value="2" <dtml-if expr="MODLEVEL ==
> 2">SELECTED</dtml-if> >2</option>
> 		Etc, etc.
> </dtml-if>
>
> Regards, JL.
>
>
>
> _______________________________________________
> Zope maillist  -  Zope at 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 )
>



More information about the Zope mailing list