|
You are here: Home / Documentation / MailForm: The Sitellite Form API |
MailForm: The Sitellite Form API
In MailForm, you can define forms in what are
called settings files, and load them in your class constructor, so that
you don't have to hard-code fields and field properties. Like
access files (the access.php file), settings files are defined in the
INI format.
Here is a basic settings file that we will use with our example form. Save it to the same folder as the index.php and access.php files, and call it settings.php. ; <php /* [Form] title = Contact Us message = Use this form to contact our company. [name] type = text alt = Your Name [email] type = text [message] type = textarea [submit_button] type = submit setValues = Send ; */ ?>Now if we add a new line to our index.php file (highlighted in bold), when we refresh our browser window we will see the form now renders as a complete contact form. <?php
class WebappContactForm extends MailForm {
function WebappContactForm () {
parent::MailForm ();
// create form widgets here
$this->parseSettings ('inc/app/webapp/forms/contact/settings.php');
}
function onSubmit ($vals) {
// handle form action here
}
}
?>
Next: Form ValidationPage 1: Sitellite features one of the mo... |
|
Copyright © 2008, SIMIAN systems Inc. All rights reserved. Privacy policy Some of the icons on this site were created by the Gnome Project. |