Validating and Submitting Flash Forms

Today we write our own ActionScript function to validate our Flash form. We see how the Flash form components have methods that we can use to access the values of the form components, be they combo boxes, list boxes, check boxes or simple text inputs.

In order to make our validation meaningful and complete, we clean up the form input by stripping leading and trailing white space from the input, as well as performing some basic testing to see if an email address is in the correct format. Because these functions are not native to ActionScript, we import them from external sources.

For people that filled the form in incorrectly, we build a dialog that displays the problems with the person's data entry. Once the data is validated, we build some root variables that contained the valid data and then send the information to a PHP script.

This is suitable for intermediate Flash developers, as it builds upon two previous beginner's tutorials, but reading those is not necessary, and the .FLA files are provided for download.

$2.79
- OR -

Overview

Table of Content:

  • Form validation
  • Using ActionScript to validate
  • Name and Email
    • Removing leading and trailing spaces
    • Checking for a valid email address
  • Testing for a gender
  • Testing for a selected country
  • Doing something with all these errors
  • Sending the data to a script
  • Conclusion

Allan Kent

Allan KentAllan comes from Cape Town, South Africa. He has been implicated in writing for several WROX, glasshaus, Wiley and Apress publications, generally in the 'cool stuff that PHP can do' sections.

You can catch up with him at his website http://www.mediafrenzy.co.za.

See All Postings From Allan Kent >>

Reviews

Where is the download for flash file

November 8, 2003 by miles harris
Reads well - i never found the promised download for flash file that  the tutorial was speaking of ( page 1)

RE: Where is the download for flash file

November 10, 2003 by Martha Graham

Thanks for the kind feedback. The file can be downloaded by clicking the code download link in the blue properties box.

Martha Graham
DMXzone.com

Not worth the price

March 3, 2004 by john vain
The tutorial starts off blindly.  Does not lead the reader through.  The .fla file it discusses does not open in my Flash.

You must me logged in to write a review.