About Sitellite       Screenshots       Downloads       Forge      Documentation       Community       Support

You are here: Home / Documentation / MailForm: The Sitellite Form API

MailForm: The Sitellite Form API

Lets say we want to verify that the form has somewhat correct information, or is at least complete.  To do this, we can set validation rules on the fields in our settings.php file.

; <php /*

[Form]

title = Contact Us
message = Use this form to contact our company.
error_mode = all

[name]

type = text
alt = Your Name
rule 1 = not empty, You must enter your name.

[email]

type = text
rule 1 = not empty, You must enter your email address.
rule 2 = "contains `@`, Your email address does not appear to be valid."


[message]

type = textarea
rule 1 = not empty, You must enter a message.

[submit_button]

type = submit
setValues = Send

; */ ?>
The rules take the format "rule # = definition, error message".  Also notice we also added a new line "error_mode = all" under the main [Form] section.  This line tells MailForm to display the errors in a bulleted list at the top.  Otherwise, MailForm defaults to displaying only the first error message at a time.  My personal preference is to show them all, but the choice is up to you.

You can refer to the Sitellite Application Framework (SAF) documentation on sitellite.org or in your copy of Sitellite for more information on using the rules, including more advanced validation.

Next: Form Handling

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.