A recent comment to my regexp datatype contribution reminded me of an irritating shortcoming in eZ publish. It’s not possible for datatypes to send error messages back into the class edit. It’s only implemented on the object level for some bizarre and obscure reason.
I plan to incorporate class-level error messages in the next release of the datatype (expect the release soonish) but it’s a real shame that this shortcoming has survived 8 releases so far.
But for now, back to C#
Category: eZ publish, Programming
Tag: eZ publish, Programming
Paul Borgermans says:
Hi Hans
Class level input validation for the abstract class is supported for quite a while (3 years, roughly ). It is up to the specific datatype to implement it. So what do you mean by “It’s not possible for datatypes to send error messages back into the class edit”?
Paul
Hans Melis says:
Hi Paul
I mean exactly what I wrote
Of course class validation is supported. That’s what the whole validateClassAttributeHTTPInput() function is about. What I mean is that it’s not possible to set error messages in the same way that you do on the object level.
Object attributes have a method setValidationError() which takes a text as parameter. The text you supply is the error message the user will see in object edit (after the name of the attribute).
Class attributes have no such method. If you signal the invalid state in the datatype, the class edit screen will say something like this:
“Validation failed:
- Title (id: 305)”.
A bit of a challenge for a user to know what’s wrong
Paul Borgermans says:
OK, should read better
That’s indeed a serious shortcoming, especially for such swiss knife extensions as your regexp datatype.
Happy C# programming