[Zope] dtml-if and _.['sequence-item']

Andrew Veitch andrew@logicalprogression.net
Mon, 18 Nov 2002 17:03:58 +0000


On 18/11/02 4:32 pm, "Marie Robichon" <robichon@esrf.fr> wrote:

> Hi everyone,
> 
> I canot get this example from the zope bible to work.  Any ideas
> anyone??  I am calling the form with a value for month in the namespace so
> that's not the problem:
> 
> 
> <SELECT name="month">
> <dtml-in "('January', 'February', 'March', 'April',
>           'May', 'June', 'July', 'August',
>           'September', 'October', 'November', 'December')">
>   <OPTION <dtml-if expr="month ==
> _.['sequence-item']">SELECTED</dtml-if>value="<dtml-var
> sequence-item>"><dtml-var
>   sequence-item></OPTION>
> </dtml-in>
> </SELECT>

Ugh. That's a bit messy. Neater to do:

<SELECT name="month">
  <dtml-in "('Jan', 'Feb', 'Mar')" prefix=month>
  <OPTION <dtml-if "month_item == month">SELECTED</dtml-if> value="<dtml-var
month_item>"><dtml-var month_item></OPTION>
  </dtml-in>
</SELECT>

The error in your code is instead of _.['sequence-item'] it needs to be
_['sequence-item']

There's a couple of other errors in examples in the Zope Bible so mail the
list again if you get stuck.

A

-- 
Logical Progression Ltd, 3 Randolph Crescent, Edinburgh, EH3 7TH, UK
Tel: +44 (0)131 466 9585 Web: http://www.logicalprogression.net/