[Zope3-Users] Formlib and custom validation constraints

Thierry Florac thierry.florac at onf.fr
Mon Mar 19 13:30:51 EDT 2007


  Hi,

I'm having a few problem(s) with Zope3's formlib package.
Actually, I've defined a 'Bytes' property to store an external file
which is sometimes required, sometimes not, depending on a set of
current context values.
The interface field is actually defined as "required=False", which is
the more current case ; when field is required, setting
"self.widgets['myfield']" is enough in "setUpWidgets" to display the
field as mandatory, but not to let this constraint to be checked.

So my question is simple : how do I have to handle such custom
constraints, which are applied to only one field and which I don't want
to define via invariants (because I'd like the error message to be
displayed correctly next to the required widget) ?
Until now I've tried a few methods (via "widget._error" property for
example) not nothing gave me correct results...

Thanks for any help,

  Thierry Florac

P.S. : I currently use Zope-3.3.1


-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : thierry.florac at onf.fr
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85



More information about the Zope3-users mailing list