[Zope] HTML <Select> box and tal

Joseph Griffin jgriffin@pclnet.net
Mon, 16 Sep 2002 05:34:32 -0500


Good Morning,
I find this example in the list archieves and I'm having trouble getting it
to work.

This error returned is:

Error Type: Undefined
Error Value: selected not found in 'options/salutation/selected', at line
14, column 5

Script:

d1={}
d1['ID']=1
d1['name']='Mr.'
d1['selected']='No'

d2={}
d2['ID']=2
d2['name']='Mrs.'
d2['selected']='No'

d3={}
d3['ID']=3
d3['name']='Ms.'
d3['selected']='No'


d4={}
d4['ID']=4
d4['name']='Miss'
d4['selected']='No'

salutation=[]
salutation.append(d1)
salutation.append(d2)
salutation.append(d3)
salutation.append(d4)
return context.Test.zptOption(salutation=salutation)

zptOption Template:

<html>
  <head>
    <title tal:content="template/title">The title</title>
  </head>
  <body>
<p>THis is a paragraph</p>

<p tal:content="options/salutation">Content</p>


   <form>

<select name="location">
    <option      tal:define="select_flag options/salutation/selected"
                 tal:repeat="item options/salutation"
                 tal:condition="item"
                 tal:attributes="value item/ID;selected
python:select_flag==salutation.selected"
                 tal:content="saluation/name">
    Location Name
    </option>
</select>

</form>
</body>
</html>


Thanks