[ZWeb] Highliting data from multiple selection list
Christian Theune
ct@gocept.com
Tue, 5 Mar 2002 21:55:34 +0100
Hi.
On Tue, Mar 05, 2002 at 02:11:57PM -0700, Mike Tran wrote:
> Does anyone know how to highlite data from a multiple selection list?
>
> I have a method called <agency_lookup> and a selection list
> called "jurisdiction" . The "agency_lookup" method display all the
> agency_names in my agency table. I also have a field called
> agency_selected. Agency_selected is a string in the DB that store all the
> agency name(s) that the user have selected.
>
> What i want to do is to highlite all the agency_name that are in the
> agency_selected record. This is what i have so far but Zope does not like:
> <dtml-if "agency_selected in agency_name">. agency_selected is defined.
> Maybe just a syntax error. Can someone help please? I appreciate any
> suggestions.
>
> <select name="jurisdiction:list" size="6" multiple>
> <dtml-in agency_lookup>
> <dtml-if "agency_selected in agency_name">
here lies your problem, because agency_selected is a string, not a list.
If your string contains comma separated values, try:
"agency_name in agency_selected.split(',')"
everything else seems fine, except you could optimize the use of <option>
by only doing <option value=".." <dtml-if "..">selected</dtml-if> >
> <option value="<dtml-var agency_name>" selected><dtml-var
> agency_name></option>
> <dtml-else>
> <option value="<dtml-var agency_name>"><dtml-var agency_name></option>
> </dtml-if>
> </dtml-in>
> </select>
>
> Thanks,
>
> Mike
Greetings
Christian
--
Christian Theune - ct@gocept.com
gocept gmbh & co.kg - schalaunische strasse 6 - 06366 koethen/anhalt
tel.+49 3496 3099112 - fax.+49 3496 3099118 mob. - 0178 48 33 981
reduce(lambda x,y:x+y,[chr(ord(x)^42) for x in 'zS^BED\nX_FOY\x0b'])