Sylvain Wallez wrote:

Sylvain Wallez wrote:

Now I think that every widget should be able to have validators. Some use cases:
- on a form, to perform some inter-field validations, and even application-level validation if the means to access application data is given to the validator.
- on a repeater, to check e.g. uniqueness of some values among rows
- on a group (i.e. "class", "struct", etc) where some validation between the various widgets of the group may be wanted (actually, a form is a group)


+1. I presume that it will be possible to define form-/repeater- level validators in form definition file, as well as set them from Java. Am I right?



The current ValidationRule interface is not suited for this, as it is really tied to widgets that have a value, which neither form nor repeater have.

So my idea is to introduce a generalized "WidgetValidator" with a single "validate(Widget w, FormContext ctx)" method. The current ValidationRule implementations we have today can then simply become subclasses of a "FieldValidator" abstract class.


No objections. What about suggestion to allow nested validators?


Vadim


Reply via email to