[ZPT] Re: option selected?
cccurvey
scurvey at nwaf.com
Mon Jan 5 14:30:15 EST 2004
I get that, but I can't figure out how to get TAL to just give me the
"selected" keyword on the one option that I want. And the examples
that I've been able to find on the web look a lot like mine.
Thanks for the response.
-Chris
--- In zpt at yahoogroups.com, robert <robert at r...> wrote:
> I think your problem is that you just have to have the word
"selected" to mark
> an option as selected.
> <select name="categoryId">
> <option value="1" >Foo</option>
> <option value="2" "selected">Bar</option>
> <option value="3">Snafu</option>
> </select>
>
> <
> On Monday 05 January 2004 20:15, cccurvey wrote:
> > Ack! I'm both confused and off-topic! I'm trying to make sure that
> > the select box that's in the form reflects the state of the record
> > that was retrieved from the database (and I'm using the SimpleTAL
> > package from owlfish.com to do this outside of Zope).
> >
> > Category:
> > <select name="categoryId">
> > <option tal:repeat="category categoryList"
> > tal:attributes="selected
> > python:category['categoryId']==case.categoryId;
> > value category/categoryId"
> > tal:content="category/categoryName">
> > </option>
> > </select>
> >
> > This all works well and gives me something like
> >
> > <select name="categoryId">
> > <option value="1" selected="false">Foo</option>
> > <option value="2" selected="true">Bar</option>
> > <option value="3" selected="false">Snafu</option>
> > </select>
> >
> > But the problem is that the browsers seem to be always selecting the
> > last item in the list. It appears that they pick the last option with
> > a "selected" attribute, regardless of what the value is.
> >
> > How do I work around this to only put the "selected" tag on the option
> > which is actually selected?
> >
> > If I'm too far off-topic, let me know and I'll be quiet.
> >
> > Thanks!
> >
> >
> > _______________________________________________
> > ZPT mailing list
> > ZPT at z...
> > http://mail.zope.org/mailman/listinfo/zpt
>
>
> _______________________________________________
> ZPT mailing list
> ZPT at z...
> http://mail.zope.org/mailman/listinfo/zpt
More information about the ZPT
mailing list