Skip to content
Justin Campo edited this page Oct 24, 2015 · 1 revision

The general data format is explained below. Most fields are select explanatory but if they require more detail they are described further down the page.

//Overview
public $action = ""; //the location script will submit to
public $auto_class = true; //autogenerate classes
public $auto_id = true; //autogenerage ids (based off name)
public $auto_name = true; //autogenerate name (based off label)
public $auto_option_value = true; //autogenerate option value (based off name)
public $auto_tab_index = true; //autogenerate tab index
public $cache_directory = "xesm/plugin/form/cache/"; //cache directory where cache file lives
public $cache = ""; //the local location of the cache file
public $captcha = false; //generate captcha
public $captcha_label = "Security Question:"; //text to display for captcha
public $captcha_system = "simple"; //which type of captcha to use
public $css_file = ""; //load css file = file location
public $container = true; //when rendering output a container div
public $debug = false; //display debug information
public $editor = "/template/shelter/ckeditor/ckeditor.js"; //location of editor file
public $enctype = "application/x-www-form-urlencoded"; //encoding type of form (multipart/form-data)
public $honeypot = false; //a hidden field to catch bots
public $id = ""; //the html id for the form element
public $js = true; //will the form use javascript
public $js_file = ""; //load js file = file location
public $markup = "html"; //assigns the markup language for the format (xhtml)
public $method = "post"; //form submission method (post/get)
public $prefix = "form_"; //text that gets appended to various html elements
public $prefix_js = "form"; //text that gets append to js variables
public $reset = ""; //controls rendering and text for reset button
public $submit = "Submit"; //controls rendering and text for submit button
public $title = ""; //controls rendering and text for title
public $validate = true; //validate form settings in backend system (adds overhead)

//system properties
private $autofocus_count = 0; //system count for how many autofocus are declared
private $c = array(); //system that will generate form items + javascript class from
private $cache_status = "off"; //system indicator to determine status of cache system (off/primed/complete/clear)
private $error = array(); //system errors
private $item = array(); //system form item objects
private $item_count = 0; //system count for $items
private $warning = array(); //system warnings

The items above are explained in more detail below (alphabetical order)

###action Where the form will send the data to, blank means self

Type : string

###auto_class This setting will assign class values to all elements if marked as true. You can still apply custom classes as well.

Type : boolean

###auto_id This setting will assign ids to elements values to all elements if marked as true. You can still apply custom ids if want and the automatic setting will be ignored for that element

Type : boolean

###auto_name This setting will assign names to elements values to all elements if marked as true. The name is based off label. You can still apply custom name if want and the automatic setting will be ignored for that element

Type : boolean

###auto_option_value This setting will assign value to options (select/radio/checkbox etc) based off value. You can still apply custom name if want and the automatic setting will be ignored for that element

Type : boolean

###auto_tab_index By assigning values to tabindex you can allow to navigate the form with their tab key. Setting this value to true will automatically assign the index numbers based on the order they are inserted into form

Type : boolean
Note : Does not apply for h1->h6, div or radio items.  Does not apply to select options.

###c The container array that holds the javascript and item classes

Type : array

###cache The relative path/name of the cache file

Type : string

###cache_directory The systemfolder to stores all cached files. This folder must be writable by PHP

Type : string

###cache_status The current state of the cache system.

Type : string
Values : off/primed/complete/clear

###captcha A captcha is a test to prove that the submitting of the form is done by a human. Marking the following value as true enables the test.

Type : boolean

###captcha_label The label that will be displayed if the captcha system is being used.

Type : string

###captcha_system Which captcha system will be utilized for this form

Type : string
Values: simple

###css_file If this field has a value assigned it will be included as an stylesheet on the top of the form

Type : string

###container Create a div that surrounds the entire form

Type : boolean

###debug Display the system data behind the scenes. Prevents form from getting rendered

Type : boolean

###editor The location of the editor on the server (relative to www/public_html). This is only required if the form is using an editor.

Type : string

###enctype Declare the encoding type the form sends data

Type : string
Valid Values : multipart/form-data/post, application/x-www-form-urlencoded

###error Stores all errors for the form (derived from all errors attached to item objects)

Type : array

###honeypot By assigning this value you true an extra text input will be added to the end of your form. This will be given a css class of $this->prefix."Honeypot". This class should display:none the field so it is not visible to the user. The idea is an machine will fill out this field when they submit the form. By checking to make sure the field is empty we add extra security that the form is not being submitted by a machine.

Type : boolean

###id The id assigned to the form

Type : string

###item An array of all the form item objects.

Type : array

###item_count The count of the number of items in the form

Type : int
Note : internal use only, not assigned by user

###js A flag indicating if javascript is going to be used to validate the form. This is triggered by the user of minlength, maxlength, required, validate and equals

Type : boolean
Note : internal use only, not assigned by user

###js_file If this field has a value assigned it will be included as an external javascript file on the top of the form

Type : string

###markup What formatting to output the html in.

Type : string
Valid Values : html, xhtml

###method The encoding type the form will be submitted as

Type : string
Valid Values : get, post

###prefix The string to append to all form html elements

Type : string

###prefix_js The string to append to all form js elements and functions

Type : string

###reset This variable controls if a reset button is added to the form

Type : string
Note : Any value for this var will trigger a submit to be rendered, the value of the string will be the value and name of the reset element

###submit This variable controls if a submit button is added to the form

Type : string
Note : Any value for this var will trigger a submit to be rendered, the value of the string will be the value and name of the submit element

###title A title will be added to the top of the form with an id of $this->prefix."Title" if this variable has a value

Type : string

###validate This flag will determine if the data submitted to create the form should be validated. This creates greater overhead but prevents user error. It is recommended to validate while creating the form and then disable once you determine there are no errors/issues. If the form is being cached then validation does not occur when the cache version is loaded making it acceptable to leave this to true in production if you want.

Type : boolean

###warning Stores all warnings for the form (derived from all errors attached to item objects)

Type : array
Clone this wiki locally