[Zope3-Users] z3c.selectWidget terms without vocabulary
kevin gill
kevin at movieextras.ie
Tue Sep 30 16:34:54 EDT 2008
OK, I have it working now. Here is what I did...
1. Subclass the schema type to create a specific class for my field, e.g.
class LocalChoice(zope.schema.Choice):
"""Marks this field uniquely"""
2. Make a new class based on z3c.form.terms.ChoiceTerms, and register it
for the view and the schema field:
zope.component.adapts(
zope.interface.Interface,
z3c.form.interface.IFormLayer,
ViewClass,
LocalChoice,
z3c.form.interfaces.IWidget)
3. Put in the zcml
<adapter ...
And it is picked up fine.
Thanks
Kevin
> I want to create a select widget based on a field which does not have a
> vocabulary. The possible values are determined based on the context or the
> view.
>
> How do I configure the z3c SelectWidget to pick up the terms from a set of
> terms I provide, rather than looking to the field.
>
> I see from the code that it looks up a registered adapter, but I don't
> understand how to control this on a view instance basis.
>
> Thanks
>
> Kevin
>
>
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>
> --
> ** Email Scanned by Elive's Virus Scanning Service -
> http://www.elive.net **
>
>
>
>
>
More information about the Zope3-users
mailing list