Dynamically assigning the 'From Name' and 'From Email' fields of the result email
Dynamically assigning the subject and heading fields of the result email
Displaying a thank-you message in a different frame (instead of using a textfield)
Displaying a required fields message using a movieclip (instead of using a textfield)
Displaying a JavaScript pop-up alert message
DYNAMICALLY ASSIGNING THE 'FROM NAME' AND 'FROM EMAIL' FIELDS OF THE RESULT EMAIL
You can use the fields in which the user has entered their name and email, to appear in the "from name" and "from email" field of the form response email. This is useful to reply to form emails by pressing the 'reply' button in your email program (without having to enter the address).
Say the name field in your form has an instance name of "Name", the email field has an instance name of "Email" and the EZform component has an instance name of myForm. You would change the action on the submit button to the following:
myForm.fromName = Name.text;
myForm.fromEmail = Email.text;
myForm.submitForm();If you are using the Actionscript 2 button component (not the Actionscript 3 version), use the following code instead:
_parent.myForm.fromName = _parent.Name.text;
_parent.myForm.fromEmail = _parent.Email.text;
_parent.myForm.submitForm();
DYNAMICALLY ASSIGNING THE SUBJECT AND HEADING FIELDS OF THE RESULT EMAIL
You may want to use fields from your form as the subject and heading of the form response email. In this example we'll be using a field with instance name "MySubject" to be the subject field and a field with instance name "MyHeading" to be the heading field. The action on your submit button would look something like this:
on (release) {
myForm.subject = MySubject.text;
myForm.heading = MyHeading.text;
myForm.submitForm();
}If you are using the button component, use the following code instead:
on (release) {
_parent.myForm.subject = _parent.MySubject.text;
_parent.myForm.heading = _parent.MyHeading.text;
_parent.myForm.submitForm();
}If you are using Actionscript3, use the following code instead:
import flash.events.MouseEvent;
myButton.addEventListener(MouseEvent.CLICK, onMouseClick);
function onMouseClick(eo:MouseEvent):void {
myForm.subject = MySubject.text;
myForm.heading = MyHeading.text;
myForm.submitForm();
}
* Where "myForm" is the instance name of the EZform component that you are using.
DISPLAYING A THANK-YOU MESSAGE IN A DIFFERENT FRAME (instead of using a textfield)
This will explain how to show the viewer a "Thank You" message after the form was sent.
1. Assign an instance name to the EZform component that is on the stage. In this example, we'll use the name "myForm".
2. Create a new layer and call it "thankyou" as seen in FIGURE A
3. Insert a keyframe in frame 2 and create a "Thank You" message on the stage, such as the one shown in FIGURE B
| FIGURE A | FIGURE B |
|
|
|
4. Add a "stop" action to both frame 1 and frame 2 (this will prevent the movie from looping).
5. If you're publishing for Actionscript 2 copy and paste the following code into frame 1 (or wherever the form is located):
myForm.onSubmit = function() {
gotoAndStop(2);
};
If you're using the EZform-HTML Actionscript 3 component use this code instead:
import com.flashloaded.EzFormHTML_AS3;
myForm.addEventListener(EzFormHTML_AS3.ON_SUBMIT, onSubmit);
function onSubmit(eo:Event):void {
gotoAndStop(2);
};
If you're using the EZform-TEXT Actionscript 3 component use this code:
import com.flashloaded.EzFormTEXT_AS3;
myForm.addEventListener(EzFormTEXT_AS3.ON_SUBMIT, onSubmit);
function onSubmit(eo:Event):void {
gotoAndStop(2);
};
6. In order to use the onSubmit event (as we did in this example), you must ensure that no value is entered in the "Sent Textfield" parameter.

DISPLAYING A REQUIRED FIELD MESSAGE USING A MOVIECLIP (instead of using a textfield)
In order to activate the movieclip, you'd need to create an onErrorRequired event. This can be done with a function that activates a movie clip (that is on stage) to play when a required field is not entered. For example in Actionscript 2:
myForm.onErrorRequired = function() {
requiredMC.gotoAndPlay(2);
}
If you're using EZform-HTML Actionscript 3 you would use this code:
import com.flashloaded.EzFormHTML_AS3;
myForm.addEventListener(EzFormHTML_AS3.ON_ERROR_REQUIRED, onError);
function onError() {
requiredMC.gotoAndPlay(2);
}
Alternately for the EZform-TEXT Actionscript 3 you would use this code:
import com.flashloaded.EzFormTEXT_AS3;
myForm.addEventListener(EzFormTEXT_AS3.ON_ERROR_REQUIRED, onError);
function onError() {
requiredMC.gotoAndPlay(2);
}
You must also ensure that no value is entered in the "Required Textfield" parameter on the EZform component properties panel.
You can also create similar events to display a message when an invalid Email address or URL is entered. To do this, you would use the onErrorEmail and onErrorURL events for Actionscript 2 or the ON_ERROR_EMAIL and ON_ERROR_URL events for Actionscript 3.
DISPLAYING A JAVASCRIPT POP-UP ALERT MESSAGE
You may choose to display a pop-up Javascript alert message to tell the user that a required field is missing, an invalid email address or url has been entered, or to informt the user that the for has been submitted. The onErrorRequired, onErrorEmail, onErrorURL, onSubmit, ON_ERROR_REQUIRED, ON_ERROR_EMAIL, ON_ERROR_URL, ON_SUBMIT and ON_SUBMIT_ERROR events can all be used to create this. For example:
myForm.onErrorEmail = function() {
getURL("javascript:alert('An invalid email address has been entered')");
}