O'Reilly logo

Agile Enterprise Application Development with Flex by Tony Hillerson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required