Re: Re: [Zope] tal:atrributes problem
sir, i guess i'm not gettin it. kindly tell me the syntax. wats happeneing is dat its setting the last item as selected. where as i want the item matching the result from 'distname' var sud be selected only. kindly gimme the syntax if possible. On Wed, 23 Mar 2005 Jürgen Herrmann wrote :
i succeeded in either setting the selected attribute to "selected" or "", hth
juergen herrmann
[ prabuddha ray wrote:]
I've got to set the particular item selected in a dropdown list which was in the request object.this is fetched by reloading the page.
i've a var 'distname' which holds wat has been selected
<body tal:define="distname request/form/districtname|nothing" onload="foc()">
wen i use this in my option tag of the list with the attribute tag nothing happens.
<option tal:content="district/district_name" tal:attributes="selected distname"></option>
i guess coz the 'selected' attribute don take any values. so how do do it?
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
try something like this: <option tal:content="district/district_name" tal:attributes="selected python:test(distname==district.district_name, 'selected', '')"></option> regards, juergen herrmann [ prabuddha ray wrote:]
sir, i guess i'm not gettin it. kindly tell me the syntax. wats happeneing is dat its setting the last item as selected. where as i want the item matching the result from 'distname' var sud be selected only. kindly gimme the syntax if possible.
On Wed, 23 Mar 2005 Jürgen Herrmann wrote :
i succeeded in either setting the selected attribute to "selected" or "", hth
juergen herrmann
[ prabuddha ray wrote:]
I've got to set the particular item selected in a dropdown list which was in the request object.this is fetched by reloading the page.
i've a var 'distname' which holds wat has been selected
<body tal:define="distname request/form/districtname|nothing" onload="foc()">
wen i use this in my option tag of the list with the attribute tag nothing happens.
<option tal:content="district/district_name" tal:attributes="selected distname"></option>
i guess coz the 'selected' attribute don take any values. so how do do it?
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
_______________________________________________________________________
XLhost.de - eXperts in Linux hosting <<
Juergen Herrmann Weiherweg 10, 93051 Regensburg, Germany Fon: +49 (0)700 XLHOSTDE [0700 95467833] Fax: +49 (0)721 151 463027 ICQ: 27139974 - IRC: #XLhost@quakenet WEB: http://www.XLhost.de
On Wed, 23 Mar 2005 12:11:12 +0100 (CET), Jürgen Herrmann <Juergen.Herrmann@xlhost.de> wrote:
try something like this:
<option tal:content="district/district_name" tal:attributes="selected python:test(distname==district.district_name, 'selected', '')"></option>
That's a bit overly complicated. tal:attributes="selected python:distname==district.district_name" is enough. -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/
[ Lennart Regebro wrote:]
On Wed, 23 Mar 2005 12:11:12 +0100 (CET), Jürgen Herrmann <Juergen.Herrmann@xlhost.de> wrote:
try something like this:
<option tal:content="district/district_name" tal:attributes="selected python:test(distname==district.district_name, 'selected', '')"></option>
That's a bit overly complicated. tal:attributes="selected python:distname==district.district_name" is enough.
as far as i remeber the selected attribute should only contain 'selected' if you'd like to be xhtml compliant. but hey, if your version works with the standard browsers, i'll also go for this version, cause it's much more readable... regards, juergen herrmann _______________________________________________________________________
XLhost.de - eXperts in Linux hosting <<
Juergen Herrmann Weiherweg 10, 93051 Regensburg, Germany Fon: +49 (0)700 XLHOSTDE [0700 95467833] Fax: +49 (0)721 151 463027 ICQ: 27139974 - IRC: #XLhost@quakenet WEB: http://www.XLhost.de
On Wed, 23 Mar 2005 13:17:07 +0100 (CET), Jürgen Herrmann
as far as i remeber the selected attribute should only contain 'selected' if you'd like to be xhtml compliant.
but hey, if your version works with the standard browsers, i'll also go for this version, cause it's much more readable...
Well, this code: <option tal:repeat="statusid statuslist" tal:attributes="value statusid; selected python:status==statusid" tal:content="statusid" /> results in this html: <option selected="selected" value="ACCEPTED">ACCEPTED</option> <option value="DECLINED">DECLINED</option> <option value="TENTATIVE">TENTATIVE</option> <option value="DELEGATED">DELEGATED</option> So it seems to be fine (For Zope 2.7.4 at least). -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/
participants (3)
-
Jürgen Herrmann -
Lennart Regebro -
prabuddha ray