[Zope] soln found for two drop down

prabuddha ray buddha_2001 at rediffmail.com
Sat Mar 12 04:45:46 EST 2005


Thanks yuan.
  i finally got it .

I think i'll be much happier and productive with ZPTs.

In the body tag define:

<body tal:define="doDistrict request/districtname|nothing">

  this was for 1st dropdown list ;

  <select name=districtname style="HEIGHT: 22px; WIDTH: 185px"
  onchange="user10()">
                      // in user10() i submit the form 
explicitly.
     <option name="selectDistrict" selected>
     <div tal:repeat="district container/getDistrict">
     <option tal:content="district/district_name"></option>
     </div>
  </select>

2nd drop down list :

<select name=username style="HEIGHT: 22px; WIDTH: 185px" 
tal:condition="doDistrict"
  <div tal:repeat="user     
python:context.getDistrictUser(districtname=request.form['districtname'])">
         <option tal:content="user/username"></option>
  </div>
</select>

That got rid of the error.
I was wondering whether in my Python script getDistricUser i could 
also, by default, assume that i'm passing in districtname. Then I 
cud just say
        <div tal:repeat="user here/getDistrictUser">
which is more pleasing to the eye.

By saying "or nothing" when I define variable doDistrict
I can then test for it later. And it evaluates to false on the 
first
pass.


So any tips.




More information about the Zope mailing list