• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Lesson 13. Validating Data > Validating Against a List of Choices

Validating Against a List of Choices

There are times when a value entered into a form must match one of several choices. For example, if a form asks the user to enter a specific color—red, yellow, or blue—and the user accidentally enters rod or yullow instead, it's important to be able to detect that error when validating the form.

If you're going to compare data entered against a list of choices, obviously you must define that list first. In ActionScript, an array can include a list of choices. The validation process is simply a matter of comparing the entered data against the values in the array to see if there's a match.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint