[Zope3-dev] Access to widget errors

Garrett Smith garrett at mojave-corp.com
Thu Sep 9 11:14:51 EDT 2004


Marius Gedminas wrote:
> I want to be able to freely set error conditions on arbitrary widgets.
> This is needed for form validation with variable constraints.  I've
> written a short proposal:
> <http://dev.zope.org/Zope3/AccessToWidgetErrors> that explains this
> use case more explicitly (and adds another one), and suggests a
> solution. 
> 
> I'd be happy if Zope 3 form/widget experts could take a look at it.
> 
> Marius Gedminas

Hi Marius,

It seems like you have these goals:

1 - Flexibility in the way widget errors are rendered relative to
(layout-wise) to their widgets

2 - The ability to override a widget's error

3 - You also mention object-level validation, though in passing

Re goal 1, you can skin the 'widget_row' macro (see its use in edit.pt
and its default impl in widget_macros.pt) to override how
labels/widgets/errors are handled. Perhaps this meets your need...if
not, we might need some tweaking.

I'm unclear as to why you'd want to override _error, though. Are you
wanting to add marker interfaces for view lookup? I guess before we open
up _error in a public API we should be doubly sure its necessary. (If
this is a unique situation, could you subclass the widget and use it in
a skin? You'd be looking at overriding getInputValue and configuring the
error as needed.)

As to goal 3, we will be implementing subscription based form validation
(at some point...see Jim) as defined here:

  http://dev.zope.org/Zope3/NoMoreSchemaBinding

 --Garrett



More information about the Zope3-dev mailing list