- Flash Form Validation Tutorial
Flash Form Validation
Validation of fields in Flash forms using JScript and VBScript
As part of our Flash and ASP integration tutorial series, this step deals with the concept of validating fields in flash forms. Validation is done to prevent users from giving invalid or null data. Javascript validation should always be accompanied by server-side validation in ASP so that browsers which have javascript disabled are also validated. We will now learn to validate the input form in our Flash 'n' ASP Guest-Book.
Important : To validate forms, you need a Netscape browser version 3.0 or later, or an Internet Explorer browser version 5.0 or later. Browsers must be JavaScript-enabled and have Flash Player 5.
Note : Values or code you will have to enter are given in light blue and red show specific settings to be followed by you. Comments in ASP are in bold green.
Starting Flash Guest-Book Interface

Input form Validation in our Flash 'n' ASP Guest Book
We shall now see how to validate the input form with the Name and Email fields needed to be entered and the email field being a valid email ID
Flash Guest-Book Send function interfaces
- Double click the Send button and replace
the existing action script
with:
Set Variable: "error" = ""
If (name eq "" or email eq "")
If (name eq "")
Set Variable: "error" = error & "n"
End If
If (email eq "")
Set Variable: "error" = error & "e"
End If
FS Command ("null", error)
Else
FS Command ("error", email)
End If
Logic: Here we are checking if the name or email fields are null. If they are null then we send an FSCommand named "null" to display a javascript pop up messages for the null error. If neither of them is null then we send the email field to be validated through a FSCommand named "error"

Fig(a): Input Form
- Now insert a blank key frame after the 6th
frame of the guestbook layer (Thus too retain the old functions you
will have to add a frame to the background and counter (after
frame 4) layers too). Now double click the
frame and give this action script:
Set Variable: "iSuccess" = 0
Load Variables ("GuestBookSendCode.asp", "", vars=GET)
Set Variable: "submit" = True
Set Variable: "y" = 0
Play()
Logic: We are just placing the action script that was previously there in the send button to a frame just after the frame where it is placed.
Finishing Flash Guest-Book Interface

Adding the VBScript and JScript
Cut and paste the following VBScript and JScript in the head content of your guestbook.asp page (where you have placed the guestbook.swf file).
Flash Guest-Book Send function interfaces
Congratulations! You have now completed our Flash and ASP integration guide - hope you had fun learning with us!
Back to Step 6: Flash Interface Preloader
This tutorial covers the usage of ASP and Flash to bring about Flash dynamic data display and manipulation i.e. interactivity into Flash:- Flash and ASP Introduction
- Basics of Flash and ASP
- Preparing the Stage
- Sending Data from your Flash form to the database
- Getting Data from the database into your Flash form
- Flash preloader that waits for the data to load
- Validation of fields in Flash forms using JScript and VBScript
- Double click the Send button and replace
the existing action script

