form
extends baseform
in package
Form Class for building and displaying a form
An HTML-form building class, that supports registerable and unregisterable controls.
Tags
Table of Contents
- $action : mixed
- $controlIdx : mixed
- $controlLbl : mixed
- $controls : mixed
- $div_to_update : mixed
- $enctype : mixed
- $horizontal : mixed
- $id : mixed
- $is_paged : mixed
- $meta : mixed
- $method : mixed
- $name : mixed
- $scripts : mixed
- $style : mixed
- $validationScript : mixed
- __construct() : mixed
- __get() : null
- Generic magic method
- __isset() : bool
- Generic magic method
- __set() : mixed
- Generic magic method We MUST create/set non-existing properties for Exponent code to work
- __unset() : mixed
- Generic magic method
- addScript() : bool
- Adds a javascript to the form.
- ajaxUpdater() : mixed
- location() : bool
- Sets form location data
- meta() : bool
- Adds form meta data (hidden inputs)
- register() : bool
- Registers a new Control with the form. This function will simply append the new Control to the end of the Form.
- registerAfter() : bool
- Registers a new Control, placing it after a pre-existing named Control. If the Control that the caller wants to insert after does not exist, the new Control is appended to the end of the Form.
- registerBefore() : bool
- Registers a new Control, placing it before a pre-existing named Control. If the Control that the caller wants to insert the new Control before does not exist, the new Control is prepended to the form.
- removeScript() : bool
- Removes a javascript from the form.
- secure() : mixed
- toHTML() : string
- Convert the form to HTML output.
- unregister() : bool
- Unregisters a previously registered Control.
Properties
$action
public
mixed
$action
= ""
$controlIdx
public
mixed
$controlIdx
= array()
$controlLbl
public
mixed
$controlLbl
= array()
$controls
public
mixed
$controls
= array()
$div_to_update
public
mixed
$div_to_update
= \null
$enctype
public
mixed
$enctype
= ""
$horizontal
public
mixed
$horizontal
= \false
$id
public
mixed
$id
= \null
$is_paged
public
mixed
$is_paged
= 0
$meta
public
mixed
$meta
= array()
$method
public
mixed
$method
= "post"
$name
public
mixed
$name
= "form"
$scripts
public
mixed
$scripts
= array()
$style
public
mixed
$style
= \false
$validationScript
public
mixed
$validationScript
= ""
Methods
__construct()
public
__construct() : mixed
Return values
mixed —__get()
Generic magic method
public
__get( $property) : null
Parameters
Return values
null —__isset()
Generic magic method
public
__isset( $property) : bool
Parameters
Return values
bool —__set()
Generic magic method We MUST create/set non-existing properties for Exponent code to work
public
__set( $property, $value) : mixed
Parameters
Return values
mixed —__unset()
Generic magic method
public
__unset( $property) : mixed
Parameters
Return values
mixed —addScript()
Adds a javascript to the form.
public
addScript(string $name, string $script) : bool
This may be used for validation, dynamic controls, etc.
Parameters
- $name : string
-
The internal name to reference the script. This is used by the Form object for removing the script later (if desired)
- $script : string
-
The path to the script file, relative to the BASE of the site.
Return values
bool —Returns true if a script with the specified internal name does not already exist, and the new one was added, or false if not.
ajaxUpdater()
public
ajaxUpdater([mixed $module = null ][, mixed $ajax_action = null ][, mixed $div_to_update = null ]) : mixed
Parameters
- $module : mixed = null
- $ajax_action : mixed = null
- $div_to_update : mixed = null
Return values
mixed —location()
Sets form location data
public
location( $loc) : bool
Parameters
Return values
bool —meta()
Adds form meta data (hidden inputs)
public
meta( $name, $value) : bool
Parameters
Return values
bool —register()
Registers a new Control with the form. This function will simply append the new Control to the end of the Form.
public
register(string $name, string $label, formcontrol $control[, bool $replace = true ][, array<string|int, mixed> $params = null ]) : bool
Parameters
- $name : string
-
The internal name of the control. This is used for referring to the control later. If this is a null string, the Control will not be registered, and this function will return false.
- $label : string
- $control : formcontrol
-
The Control object to register with the form.
- $replace : bool = true
-
boolean dictating what to do if a Control with the specified internal name already exists on the form. If passed as true (default), the existing Control will be replaced. Otherwise, the Control registration will fail and return false.
- $params : array<string|int, mixed> = null
Return values
bool —Returns true if the new Control was registered.
registerAfter()
Registers a new Control, placing it after a pre-existing named Control. If the Control that the caller wants to insert after does not exist, the new Control is appended to the end of the Form.
public
registerAfter(string $afterName, string $name, string $label, object $control[, array<string|int, mixed> $params = null ]) : bool
Parameters
- $afterName : string
-
The internal name of the Control to register the new Control after.
- $name : string
-
The internal name of the new Control.
- $label : string
- $control : object
-
The Control object to register with the Form.
- $params : array<string|int, mixed> = null
Return values
bool —Returns true if the new Control was registered.
registerBefore()
Registers a new Control, placing it before a pre-existing named Control. If the Control that the caller wants to insert the new Control before does not exist, the new Control is prepended to the form.
public
registerBefore(string $beforeName, string $name, string $label, object $control[, array<string|int, mixed> $params = null ]) : bool
Parameters
- $beforeName : string
-
The internal name of the Control to register the new Control before.
- $name : string
-
The internal name of the new Control.
- $label : string
- $control : object
-
the Control object to register with the Form.
- $params : array<string|int, mixed> = null
Return values
bool —Returns true if the new Control was registered.
removeScript()
Removes a javascript from the form.
public
removeScript(string $name) : bool
Parameters
- $name : string
-
The internal name of the script to remove. This was specified by the addScript() method, and is only used by the Form object.
Return values
bool —Returns true if the script was successfully removed. In practice, this method always returns true.
secure()
public
secure() : mixed
Return values
mixed —toHTML()
Convert the form to HTML output.
public
toHTML([null $form_id = null ]) : string
Parameters
- $form_id : null = null
Return values
string —The HTML code use to display the form to the browser.
unregister()
Unregisters a previously registered Control.
public
unregister(string $name) : bool
Parameters
- $name : string
-
The internal name of the control to remove from the Form.
Return values
bool —Returns true if the Control was unregistered.