[Zope] sequence items and multiple selection boxes

David Siedband david@calteg.org
Thu, 26 Jun 2003 17:52:41 -0700

I realize I didn't articulate this very well in my post...  Here is the 
solution I settled on.

      <dtml-let selectedIDs="[ai[0] for ai in 
         <select multiple name="places">
           <dtml-in "queries.getPlaces()">
             <option value="<dtml-var PLID>"<dtml-if "PLID in 
selectedIDs"> selected </dtml-if>><dtml-var CommonPlaceName></option>

I'm still interested in hearing other ways to do this.

David Siedband
web developer

Wolf and Assocaites

530.758.2338 fax

On Thursday, June 26, 2003, at 03:33  PM, Dieter Maurer wrote:

> David Siedband wrote at 2003-6-24 10:02 -0700:
>> I've got a DTML form page where people can update the locations that
>> are covered by an environmental project.  I have a multiple selection
>> HTML form element that I am populating with the results of an SQL 
>> query
>> that retuerns the complete list of locations.  I have another query
>> that returns a list of locations that are already associated with a
>> specific project.  What I'd like to do is iterate through all the
>> places and add the SELECTED property to those that are already entered
>> for a specific project.  What I have in mind is something like.
>> <dtml-in "queries.getPlacesAll()">
>>    <dtml-in "queries.getPlacesForHypothesis()" prefix=obj>
>>      <option value="<dtml-var PLID>" <dtml-if "PlaceID in (??????)">
>> selected </dtml-if>><dtml-var PlaceName></option>
>>    </dtml-in>
>> </dtml-in>
>> Suggestions?
> Most of your "??????" is application specific and you did not yet tell
> us these details...
> I assume, a ZSQL method "getPlacesForProject" returns the set of 
> associated
> PlaceIds and that "PlaceId" is used as column name to
> convey this information. Then your "?????" can somehow look like:
>        [x.PlaceId for x in getPlaceForProject(project=project)]
> Dieter