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