[Zope] Strange error using DTML with MySQL to build a Select
 List
   
    Paul Williams
     
    paul@maximpact.net
       
    Thu, 31 Jul 2003 04:06:33 -0400 (EDT)
    
    
  
Hi Dave,
I got the same result -- a nameError on selected.
What I did was move the selected to before the value=""
ie
<option selected value="...">
an example:
python code
def months(min=0, max=1000):
    min = abs(int(min))
    max = abs(int(max))
    retval = []
    if min > max:
       min, max = max, min
    while min < max:
       retval.append(min)
       min = min + 1
    return retval
dtml code
<SELECT name="total_life_in_months">
          
<dtml-in expr="scripts.get_months(1,100)" prefix="month">
       <dtml-if expr="month_item != 36">
          <option value="&dtml-sequence-item;"><dtml-var 
sequence-item></option>
       <dtml-else>
          <option selected value="&dtml-sequence-item;"><dtml-var 
sequence-item></option>
       </dtml-if>
</dtml-in>
</SELECT>
hope this helps,
PS I am using Zope 2.6.1 w python 2.1.3 and Mysql 4.1 on Solaris 9
Paul