O'Reilly logo

Professional Adobe® Flex® 3 by Joe Berkovitz, David Hassoun, Andrew Trice, Tom Sugden, Todd Prekaski, Jun Heider, Peter Ent, Joseph Balderson

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

Chapter 31. Formatters and Validators

This chapter examines the support built into the Flex framework for working with data input and output. In addition, we will touch on regular expression support in Flex. The items that will be covered are:

  • Formatters

  • Validators

  • Regular expressions

Overview

In a data-driven application, data can come from various places. Existing data might come from a backend database or XML file. It may even come from an external source such as an RSS feed. The fact that the source of data can come from so many places sheds light on the need to ensure that this data is presented to the end user in a consistent fashion.

In addition, when new data is provided to the application, it is often provided by end users through forms. When you provide the ability for an end user to enter data into your system, you are going to want to make sure that the new data adheres to certain formats and/or business rules. Otherwise, you will end up with a very inconsistent and dirty database, which can be much harder to deal with than doing the verification up front at the time of data collection.

This chapter examines formatters, validators, and regular expressions, and introduces you to the ways to use these constructs to control the presentation and format of your data in and data out. Let's first take a look at how to control data displayed in your user interface by utilizing formatters.

Formatters

The Flex framework provides the Formatter classes to assist you with manipulating data ...

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