You want to validate form data before allowing the user to submit it to a server-side script.
Use the built-in data validation features of the
Data validation can be an important feature to include in your Flash forms. Often you may have required fields in a form that you want users to fill out before submitting the form data. If they don’t fill out the form fields, you’ll want to prompt them for that information before allowing them to continue. Furthermore, you may also want to verify that the data being entered matches certain criteria. For example, you may want to make sure that the value entered into a field looks like a valid email address. Or you may want to make sure that users have entered a valid number value.
Although you can write your own data validation scripts, it can require quite a lot of ActionScript code, and it is beyond the scope of this book. However, the
FormController component (discussed in Chapter 13) provides built-in data validation features. Using the
FormController component, you can make particular form elements required, and you can also verify that entered values match particular patterns such as email or number.
In order to use the data validation features, there are two requirements. You must include a component that can display any messages to the user in your Flash document’s library, and you must specify the
Message values in the
FormController’s elements ...