[ZWeb] Highliting data from multiple selection list
Mike Tran
mtran@shufflemasterrd.com
Wed, 6 Mar 2002 16:53:42 -0700
I've tried the split method but it did not worked and I get an "object has
no attribute 'split' " error if agency_selected is blank. So, how do i turn a
string into a list?
Here's my <dtml-var agency_selected>:
['Agua Caliente Gaming Commission Spa Casino', 'Barona Band of the Capitan
Grande of Diegueno Miss', 'Bay Mills Indian Community Gaming Commission']
Thanks,
On Tue 05 Mar 02 13:55, you wrote:
> 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
--
Mike Doanh Tran
Shuffle Master Gaming Inc.