[Zope3-Users] providing IInputWidget using zope:view?

Dylan Reinhardt dylanreinhardt at gmail.com
Wed Jun 1 20:47:35 EDT 2005


So I've got some custom fields and custom widgets.  Everything works
fine if I use the widget subdirective to editform to ensure that the
correct widget is paired with each field.

For how many times I'm going to re-use certain field/widget pairs, I
would like to associate a custom input widget with a specific field
interface so that *any* time that field is rendered in an editform,
the proper widget is used.

Obviously, that's not a new idea... there's an example in Stephan
Richter's book.  He suggests something like this:

----
<zope:view
     type="zope.publisher.interfaces.browser.IBrowserRequest"
     for=".interfaces.IMyField"
     provides="zope.app.form.interfaces.IInputWidget"
     factory=".widgets.MyWidget"
     permission="zope.Public"
     />
----

So far, I haven't managed to get this to work.  I've tried a number of
things, such as adding a name, using class instead of factory, using
browser:view instead of zope:view.  All with no joy.    It doesn't
give any errors, but it doesn't provide the intended widget either.

Can anyone spare a quick example or suggest what I'm not doing correctly?

Many thanks in advance,

Dylan


More information about the Zope3-users mailing list