Chapter 9. CREATING RICH FORMS
Have you ever filled out an HTML form on a website, submitted it, and waited for the result—only to find that one of the fields had an error or omission? How easy was it to find your mistake? Was it something silly like not putting parentheses around the area code of a phone number (or putting them in if they weren’t needed)? Wouldn’t it be nice if that never happened again?
With Flex, the tasks of validating input and formatting the results are second-nature. Built into the most common controls is a great way to give feedback to people using your application if something they’ve entered isn’t correct, and there’s also an easy way to format their input. With Flex validators and formatters, you’ll be able to give your applications an easy-to-use UI.
Preparing the Application
First, you’ll return to the ContactManager application you modified in Chapter 8 to take advantage of the Form container. In this chapter, you’ll add a few fields and modify the application so it really looks like an address book. You’ll add phone number, email, address, and zip code fields, and you’ll replace the current CheckBox with one to designate whether a contact is a company. You’ll also get rid of the NumericStepper, because an actual birth date makes more sense to store (you’ll learn how to calculate an age later in this chapter). You’ll learn a great way of entering dates using the DateField control, which provides a pop-up calendar interface.
To start, make sure the ContactManager ...
Get Learning Flex 3 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.