EZform-TEXT ActionScript Reference

Introduction

Properties

formPhp
recipientEmail
subject
fromName
fromEmail
orderArray
notSend
requiredArray
requiredField
requiredMessage
emailField
emailTextField
emailMessage
urlField
urlTextField
urlMessage
sentTextField
sentMessage
submitErrorTextField
submitErrorMessage
heading
lineSpacing
layoutStyle

Events

onErrorRequired
onErrorEmail
onErrorURL
onSubmit
onSubmitError

Methods

getMissingArray
validateEmail
validateURL

 

Introduction

The following document details the use of the properties and methods of the EZform-TEXT Component via ActionScript .

If you do not want to use ActionScript, all of the following properties and methods can be set within Flash MX, Flash MX 2004, Flash 8, Flash CS3 or Flash CS4 by dropping the EZform-Text Component onto the stage and setting the properties shown in the Parameters Panel.

All examples are based on the EZform-TEXT component having an instance name of 'myForm'. In your own movie, you will replace this with whatever you name the instance of the EZform-TEXT Component.

 

Properties

formPhp

The name and path of the form php file on the webserver.

myForm.formPhp = "forms/formhtml.php";

trace(myForm.formPhp); // outputs the current formPhp value

TOP

recipientEmail

The recipient address for form response emails.

myForm.recipientEmail = "yourName@yourUrl.com";

trace(myForm.recipientEmail); // outputs the current recipientEmail value

TOP

subject

The subject of form response emails.

myForm.subject = "Feedback form response ";

trace(myForm.subject); // outputs the subject formPhp value

TOP

fromName

The name in the from field for form response emails.

myForm.fromName = Name.text; // sets the fromName to be the value entered by the user in the input field with instance name "Name"

trace(myForm.fromName); // outputs the current fromName value

TOP

fromEmail

The email address for replies to form response emails.

myForm.fromEmail = Email.text; // sets the fromEmail to be the value entered by the user in the input text field with instance name "Email"

trace(myForm.fromEmail); // outputs the current fromEmail value

TOP

orderArray

Array of fields in the order in which they should appear in the response emails.

myOrder = new Array(Name, Email, Comment); // example of order array called "myOrder"

myForm.orderArray = myOrder; // sets the orderArray array to be the array defined as "myOrder"

TOP

notSend

Array of fields or variables that should not be submitted with the form.

notArray = new Array(Required, Message); // example of array of values not to send called "notArray "

myForm.notSend = notArray; // sets the notSend array to be the array defined as "notArray"

TOP

requiredArray

Array of field instance names that are required.

myArray = new Array(Name, Email); // example of array of fields that are required called "myArray"

myForm.requiredArray = myArray; // sets the requiredArray array to be the array defined as "myArray"

TOP

requiredField

The instance name of the textField where the missing required field message should appear.

myForm.requiredField = "requiredTxt";

trace(myForm.requiredField); // outputs the current requiredField value

TOP

requiredMessage

The missing required field message.

myForm.requiredMessage = "Please complete all required fields";

trace(myForm.requiredMessage); // outputs the current requiredMessage value

TOP

emailField

The instance name of the field for e-mail validation.

myForm.emailField = "Email"; // specifies that the field with instance name "Email" is for e-mail validation.

trace(myForm.emailField); // outputs the current emailField value

TOP

emailTextField

The instance name of the textField where the invalid email address message should appear.

myForm.emailTextField = "requiredTxt"; // specifies that the field with instance name "requiredTxt" for invalid e-mail messages.

trace(myForm.emailTextField); // outputs the current emailTextField value

TOP

emailMessage

The invalid email address message.

myForm.emailMessage = "An invalid e-mail address was entered ";

trace(myForm.emailMessage); // outputs the current emailMessage value

TOP

urlField

The instance name of the textField for URL validation.

myForm.urlField = "Website"; // specifies that the field with instance name "Website" is for url validation.

trace(myForm.urlField); // outputs the current urlField value

TOP

urlTextField

The instance name of the textField where the invalid URL message should appear.

myForm.urlTextField = "requiredTxt"; // specifies that the field with instance name "requiredTxt" for invalid url messages.

trace(myForm.urlTextField); // outputs the current urlTextField value

TOP

urlMessage

The invalid URL address message.

myForm.urlMessage = "An invalid URL was entered ";

trace(myForm.urlMessage); // outputs the current urlMessage value

TOP

sentTextField

The instance name of the textField where the sent message should appear.

myForm.sentTextField = "requiredTxt"; // specifies that the field with instance name "requiredTxt" for the sent message.

trace(myForm.sentTextField); // outputs the current sentTextField value

TOP

sentMessage

The message to display in the sentTextField when the form has been sent.

myForm.sentMessage = "Thank you for submitting the form";

trace(myForm.sentMessage); // outputs the current sentMessage value

TOP

submitErrorTextField

The instance name of the textField where the submit error message should appear.

myForm.submitErrorTextField = "requiredTxt"; // specifies that the field with instance name "requiredTxt" for the submit error message.

trace(myForm.submitErrorTextField); // outputs the current sentTextField value

TOP

submitErrorMessage

The message to display when there has been an error in the submission of the form.

myForm.submitErrorMessage = "There was a problem submitting the form.";

trace(myForm.submitErrorMessage); // outputs the current submit error message value

TOP

heading

The heading line text inside the form response emails.

myForm.heading = "This is the response from the feedback back:";

trace(myForm.heading); // outputs the current heading value

TOP

lineSpacing

The line spacing between fields in the form response email.

myForm.lineSpacing = 2;

trace(myForm.lineSpacing); // outputs the current lineSpacing value.

TOP

layoutStyle

The style of the form response email.

myForm.layoutStyle = "style1";

Valid Values

"style1"
"style2"
"style3"

Events

onErrorRequired

Event to trigger when required field is omitted.

Example:

myForm.onErrorRequired = function() {

getURL("javascript:alert('Please complete all required fields')");

}

The above example will cause a java alert box to pop up when a required field has been omitted.

TOP

onErrorEmail

Event to trigger when an invalid email address is entered.

Example:

myForm.onErrorEmail = function() {

getURL("javascript:alert('An invalid email address has been entered')");

}

The above example will cause a java alert box to pop up when an invalid email address has been entered.

TOP

onErrorURL

Event to trigger when an invalid URL is entered.

Example:

myForm.onErrorURL = function() {

getURL("javascript:alert('An invalid URL has been entered')");

}

The above example will cause a java alert box to pop up when an invalid URL has been entered.

TOP

onSubmit

Event to trigger when the form is submitted.

Example:

myForm.onSubmit = function() {

gotoAndPlay(2);

}

The above example will play from frame 2 after the form has been submitted successfully.

 

onSubmitError

Event to trigger when there is a problem in submitting the form.

Example:

myForm.onSubmitError = function() {

getURL("javascript:alert('There was an error submitting the form')");

}

The above example will cause a java alert box to pop up when an error occurs when submitting the form.

TOP

 

Methods

getMissingArray

Returns an array of missing required fields.

Example:

missingArray = myForm.getMissingArray();

message = "The following required fields must be completed: ";

for(i=0; i<missingArray.length; i++) {

message += missingArray[i] + " ";

}

getURL("javascript:alert("+message+")");

The above example will display a javascript alert pop-up containing all the names of required fields that were omitted..

TOP

validateEmail

Returns true or false if email address is valid or not.

validEmail = myForm.validateEmail(email);

TOP

validateURL

Returns true or false if URL is valid or not.

validURL = myForm.validateURL(url);

TOP