First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Thomas Watson | Website: http://hikercentral.net

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: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
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: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.