[Zope] testing query results for presence in an array
David Siedband
technique@oceanicsky.com
Wed, 25 Jun 2003 10:51:28 -0700
This is for a page where the user can update the listing for a
particular project. I have a query that returns a complete list of all
locations, and another query that returns the list of locations already
selected for a given project. What I'd like to do is render the
complete list in a multiple selection form element and have the
keywords that are already entered for the project appear as selected in
this list. Here's the code:
<dtml-in "queries.getPlacesForHypothesis()" prefix=obj>
<select multiple name="places">
<dtml-in "queries.getPlacesAll()">
<option value="<dtml-var PlaceID>" <dtml-if "PlaceID in obj_items"
> selected </dtml-if>><dtml-var PlaceName></option>
</dtml-in>
</select>
</dtml-in>
About the Z SQL queries:
getPlacesAll() returns an array of PlaceID's and PlaceName's
getPlacesForHypothesis() returns a sequence of PlaceID's
How do I test to see if a place is in in the list of selected places
for a project?
thanks,
David