-
New Feature
-
Resolution: Done
-
Normal
-
None
-
Freshly
BeanValidator currently doesn't support Form validation, which renders it almost unusable, IMHO.
It's weird to write @validator annotation for each and every field in form, especially when we prefer
to defer form validation until it is actually submitted (SAVE button pressed).
Also, validation errors reporting is pretty unusable in our taste - to use it we must write validation
message handler for each and every form field! Too much boilerplate code must be introduced to use this
new validation mechanism.
We liked old Errorbox a lot, so why not to report validation errors using Errorbox? Or at least open
such an option for those who prefers it. Errorbox appears right near failed component and looks really
great, especially with new ZK6 themes. Also, Errorbox solution doesn't require ANY additional markup
from developer, so it's easier to develop pages and creates less maintenance burden.
I would like to draw your attention to ValidationContext class as well. It's very hard to use, I think.
getProperties(String) method returns ARRAY of properties. How should one know which element is form, and
which is real bean property? (and there was a case when 0 element was bean property, where usually first
0 element refers to form/component property) Why not to use wrapper class for this purpose, or even better,
create two additional methods in ValidationContext: getProperty() and getBeanProperty(), where former
would return form/component property, and later - actual bean property. This would be much more cleaner
in terms of usability, IMHO.