User Interface Validator

A design pattern for user interface validations that treats the validation rules as data making it easily configurable and maintainable. Please see http://web.archive.org/web/20050408220734/http://magic-cauldron.com/patterns/uivalidator/validator.html for more information.

I HaveThisPattern. Difference was the validation rules came from XML configuration file. -- VhIndukumar


Me too, both the basic pattern and the XML configuration. I most recently used it for a web application, and its main virtue was that the HTTP service layer could use those rules to validate incoming form parameters on POSTs, and those same rules could be used to generate jscript to perform some validation at the browser. Having a single place to define the rules for several levels of validation is very convenient. It also facilitates easy deployment-time customization of validation rules and also helps with product localization.

Observation: while I expected that the bulk of the validation would be single-field format or range checks, (e.g. AGE must an integer greater than 16) I was surprised at how much complex multi-field validation was needed (e.g. if field X has value 'M', field Y must be a 12 digit numeric code, but if field X has value 'N'...)


Actually, we have currently implemented this for a large application. To support the dependent validation, we created a rule called the "dependent" rule that returned true or false based on the rule which we depended upon. Kind of a decorator - though not quite. I am curious as to how you solved the dependent validation feature. -- VivekVenugopalan
I would use the APIs provided by Jakarta for doing any validation needed. The Jakarta commons.validator provides everything needed for validation. You can program your validation yourself or use struts.
CategoryPattern

EditText of this page (last edited August 21, 2013) or FindPage with title or text search