First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Thomas Watson | Website:

The first two functions we write are "housekeeping" functions and will be called by other functions. The first, as you see here, simply checks to see if any data has been entered into the name field. This is a pretty simplistic check, but considering the different lengths of names, it's difficult to check for something more meaningful. If the field is empty, we set a new message for the message box and return false to the calling function, otherwise returning true.

The second function is similar in that it checks to see if any data has been entered into the email field. If it has, we then check to be sure it contains a "@" and a "." indicating that it's probably a valid email (it certainly isn't without these symbols!). Again, this is a bit simple, but with the varying lengths of names and the changing Upper Level Domains it's almost impossible to check for 100% accuracy.

The calling function will set visibility on the message box to make it appear and disappear, these functions simply do the checking as set the message box text to an appropriate message.

Next is another housekeeping function, also called by other functions. The clrData function is the "click handler" for the "Clear Form" button, and is also called after data is sent to the server to clear the variables and the screen.

This may look a little strange. In the past, I've always simply cleared the variable, and that also cleared the text from the screen. However, a little trial and error told me that clearing the variable contained in the LoadVars object (formData) didn't clear the text. In checking the debugger, it cleared the variable within the object only. So I have one line of code to clear the variable, and one line to clear the text from the screen.

» Level Intermediate

Added: 2002-05-07
Rating: 9 Votes: 81
(10 being the highest)
» Author
Tom Watson is a Flash developer currently residing in Nashville, Tennessee. He's been an independant contractor in the computer business since 1989, working on web projects since the web was introduced to the Internet in 1994.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.