About Sitellite       Screenshots       Downloads       Forge      Documentation       Community       Support

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 Validation

Page 1: Sitellite features one of the mo...
Page 2: A basic MailForm file begins wit...
Page 3: In MailForm, you can define form...
Page 4: Lets say we want to verify that ...
Page 5: All we have left to do now is to...

All Tutorials

Members

Note: You can use your SitelliteForge.com account here and vice versa.

Username

Password

Forgot your password?

Not a member? Click here to register

Sitellite 5 Beta


Copyright © 2008, SIMIAN systems Inc.
All rights reserved. Privacy policy
Some of the icons on this site were created by the Gnome Project.