Validation

Like data forms and components in general, the Flex Validator could use some enhancement to make it more flexible for your application developers. In Flex, validation seems to have been designed with an assumption that software developers will mainly use it with forms and that each validator class will be dependent on and attached to only one field. Say you have a form with two email fields. The Flex framework forces you to create two instances of the EmailValidator object, one per field.

In real life, though, you may also need to come up with validating conditions based on relationships between multiple fields, as well as to highlight invalid values in more than one field. For example, you might want to set the date validator to a field and check whether the entered date falls into the time interval specified in the start and end date fields. If the date is invalid, you may want to highlight all form fields.

In other words, you may need to do more than validate an object property. You may need the ability to write validation rules in a function that can be associated not only with the UI control but also with the underlying data, that is, with data displayed in a row in a DataGrid.

Yet another issue of the Flex Validator is its limitations regarding view states of automatically generated UI controls. Everything would be a lot easier if validators could live inside the UI controls, in which case they would be automatically added to view states along with the hosting controls. ...

Get Agile Enterprise Application Development with Flex now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.