Constructors

Methods

ContactForm class

com.reintroducing.forms.ContactForm

 

 

 

Overview

Author

Matt Przybylski [http://www.reintroducing.com]

Version

1.1

Description

Creates a communication gateway between a contact form and a PHP script that checks for validity and sends the email. The e-mail checking is rudimentary at best, but it gets the job done. If someone will go through the trouble to try and break this e-mail checker, then by all means spam away (at least that's the way I see it).

The fields array should contain an object for each field. The object will have a "field" string value, which is the instance name (minus the "_txt" suffix) of the text field to check, an "error" string value which is the error text that is displayed when the error events are dispatched, and a "required" boolean that checks if the field is a required field.

As of right now, the fields that are passed into the fields array should be written as the instance name of the field minus the _txt extension. For example, if the instance name is name_txt, you pass "name" as the field string value in the fields array.

The class dispatches events depending on what happens. The events are as follows:

  • onEmailError: Dispatched if the e-mail check returns an incorrect e-mail address
  • onInvalidError: Dispatched when a required field fails the check (displays error from fields array object)
  • onMessageSent: Dispatched when the message has been successfully sent
  • onServerError: Dispatched if the server is unable to deliver the message

Constructors

 

ContactForm

Usage

var cf:ContactForm = new ContactForm($fields, $scriptURL, $email, $subject);

Description

Creates a new instance of the ContactForm class. The events "onEmailError" and "onInvalidError" will be dispatched if there is an error with the e-mail field or any other required field. The errors that will be shown are defined in the fields array.

Parameters

$fields
An array that tells the form what fields to check, what errors to display, and if the field is required or not
$scriptURL
A string that represents the path on the server to the PHP script
$email
A string representing an e-mail address that the script will send the information to
$subject
A string representing the subject of the e-mail being sent

Methods

 

sendMessage

Usage

cf.sendMessage(_root);

Description

Checks the form and dispatches the appropriate event according to what is happening.

Parameters

$root
The timeline where the fields/clips for the form are located on

Returns

Nothing