Class Form
Core utility for AJAX form handling and form validation
Methods summary
public static
|
|
public static
|
#
set( string $key, mixed $value = '' )
Setter for the class properties
Setter for the class properties
Parameters
- $key
- The property name
- $value
- The value to be set
|
public static
mixed
|
#
get( string $key, mixed $value = null )
Getter for the class properties
Getter for the class properties
Parameters
- $key
- The property name
- $value
- The default value for the property
Returns
mixed
|
public static
|
|
public static
boolean
|
#
validate( array $validations = null )
Form token validation
Parameters
- $validations
- The array of validation rules
Returns
boolean
|
public static
|
#
respond( string $formId, array $errors = null )
AJAX form responder
Parameters
- $formId
- The HTML form ID
- $errors
- The array of the errors (it is used only for generic form processing)
|
public static
mixed
|
#
value( string $name, mixed $defaultValue = null )
Permits you to set the value of an input or textarea.
Allows you to safely use HTML and characters such as quotes within form elements without breaking out of the form
Permits you to set the value of an input or textarea.
Allows you to safely use HTML and characters such as quotes within form elements without breaking out of the form
Parameters
- $name
- The input element field name
- $defaultValue
- The default value of the input element (optional)
Returns
mixed The value of the input element
|
public static
mixed
|
#
htmlValue( string $name, mixed $defaultValue = null )
Permits you to set the value to a rich text editor or any input where HTML source is required to be rendered.
Allows you to safely use HTML and characters such as quotes within form elements without breaking out of the form
Permits you to set the value to a rich text editor or any input where HTML source is required to be rendered.
Allows you to safely use HTML and characters such as quotes within form elements without breaking out of the form
Parameters
- $name
- The input element field name
- $defaultValue
- The default value of the input element (optional)
Returns
mixed The value of the input element
|
public static
string
|
#
selected( string $name, mixed $value, mixed $defaultValue = null )
Allow you to select the option of a drop-down list.
Allow you to select the option of a drop-down list.
Parameters
- $name
- The field name of the drop-down list
- $value
- The option value to check against
- $defaultValue
- The default selected value (optional)
Returns
string
'selected="selected"' if the option is found, otherwise the empty string returned
|
public static
string
|
#
checked( string $name, mixed $value, mixed $defaultValue = null )
Allow you to select a checkbox or a radio button
Allow you to select a checkbox or a radio button
Parameters
- $name
- The field name of the checkbox or radio button
- $value
- The value to check against
- $defaultValue
- The default selected value (optional)
Returns
string
'checked="checked"' if the option is found, otherwise the empty string returned
|