Author
Matt Przybylski [http://www.reintroducing.com]Version
1.1Description
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