[Zope] Getting title attribute given objectid
J. Cameron Cooper
zope-l at jcameroncooper.com
Tue Dec 14 20:04:04 EST 2004
Cliff Fogle wrote:
> First off...I just started playing with Zope today...
>
> This seems like it should be easy, but I've been searching google and
> the archives all day to no avail. I have an object ID and would like to
> display the object title as the content of a drop down menu. As it is
> now I can only display the ID:
>
> </select>
> <select name="querytype">
> <span tal:define="ids root/Database/querytype/objectIds" tal:repeat="id
> ids" tal:omit-tag="">
> <option tal:attributes="value id" *tal:content="id">*Item from sql
> method</option>
> </span>
> </select>
>
> What I want though is for the only the value to be the ID and the
> content to be the title. So something like this (which does not work):
>
> </select>
> <select name="querytype">
> <span tal:define="ids root/Database/querytype/objectIds" tal:repeat="id
> ids" tal:omit-tag="">
> <option tal:attributes="value id" *tal:content="id/title">*Item from sql
> method</option>
> </span>
> </select>
>
> I'm going to go get a good book on Zope and read it tonight. But if
> that doesn't help can anyone here help me out? Thanks
Take a look at the docs for the 'objectIds' method: it returns a list of
strings, being the ids of the contained objects.
You cannot get attributes off a string. You must get the objects
themselves. You would probably use 'objectValues' for this.
--jcc
More information about the Zope
mailing list