Author
Matt Przybylski [http://www.reintroducing.com]Version
1.0Description
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 a custom ContactFormEvent depending on what happens. The events are as follows:
- ContactFormEvent.ON_EMAIL_ERROR: Dispatched if the e-mail check returns an incorrect e-mail address (params object contains field name, error text, and error ID)
- ContactFormEvent.ON_INVALID_ERROR: Dispatched when a required field fails the check (params object contains field name, error text, and error ID)
- ContactFormEvent.ON_SUCCESS: Dispatched when the message has been successfully sent
- ContactFormEvent.ON_FAILED: Dispatched if the server is unable to deliver the message (params object contains IOErrorEvent)