[Zope3-dev] field validation in edit form
Richard Jones
richard@commonground.com.au
Sun, 13 Jul 2003 10:12:34 +1000
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sunday, July 13, 2003, at 10:08 AM, Garrett Smith wrote:
> Richard Jones wrote:
>> The standard EditView doesn't validate data - the Widgets comprising
>> that view do so (via the Fields that they represent). To perform
>> View-level validation (eg. validating fields against each other)
>> you'll need to write your own View which performs that additional
>> validation after the getWidgetsData call.
>
> While the widgets perform the field level validation, the edit form
> manages widgets and the object update. It seems odd to me not to apply
> validation logic in this context.
Note that we're currently pushing the object update handling down into
the Widgets. The standard EditView will no longer use getWidgetsData
and apply that data, but rather call each of the widgets and ask them
to apply their changes (via a new utility function called
applyWidgetsChanges). Validation is done at this step, though we're
also going to be adding a separate function which may be used to
validateWidgetsData - it'll be used in the new EditWizard code, for
example.
> What's wrong with performing simple validation, including checks for
> required, and let developers override things if they want to?
The validation logic is already implemented by the Fields. If they're
not working, then we have a bug :)
Just talked to Jim about the higher-than-field-level validation, and
his preferred approach is to implement constraints on Schemas. We may
or may not get around to implementing that today, depending on how we
go with ObjectWidget :)
I suspect you're not actually talking about higher-than-field-level
validation though :)
Richard
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (Darwin)
iD8DBQE/EKPzrGisBEHG6TARAsyuAJ43TIKCQwnK9jSr/EmBRTfrELASSwCeNYpt
p5TBEKZI93dmCg65uxz8zqU=
=pRF+
-----END PGP SIGNATURE-----