FormHelper
__construct
()
Returns an action suitable for including in a form action property.
void
action
(string $action, [string $task = null])
-
string
$action
-
string
$task
Creates a button
void
button
(string $name, string $value, [array $fields = array()], [ $additionalClasses = ''])
-
string
$name
-
array
$fields: Additional fields appended at the end of the submit button return string $html
-
string
$value: value
-
$additionalClasses
Creates an HTML checkbox
string
checkbox
(string $field, string $value, [ $isChecked = false], [ $miscFields = array()], bool $checked)
-
string
$field
-
string
$value
-
bool
$checked
-
$isChecked
-
$miscFields
Renders an email input field.
$html
email
(string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
-
string
$key: Input element's name and id
-
string|array
$valueOrArray: Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
-
array
$miscFields: A hash array with html attributes as key/value pairs (possibly including "class")
Creates a file input element
void
file
(string $key)
void
getRequestValue
( $key)
Creates a hidden form field.
void
hidden
(string $key, [string $value = null])
-
string
$key
-
string
$value
Internal function that creates an <input> element of type $type. Handles the messiness of evaluating $valueOrArray. Assigns a default class of ccm-input-$type
$html
inputType
(string $key, string $type, string|array $valueOrArray, array $miscFields)
-
string
$key: Input element's name and id
-
string
$type: Accepted value for HTML attribute "type"
-
string|array
$valueOrArray: Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
-
array
$miscFields: A hash array with html attributes as key/value pairs (possibly including "class")
Creates a label tag
string
label
(string $field, string $name)
-
string
$field
-
string
$name
Create an HTML fragment of attribute values, merging any CSS class names as necessary
string
parseMiscFields
(string $defaultClass, array $attributes)
-
string
$defaultClass: Default CSS class name
-
array
$attributes: A hash array of attributes (name => value)
Renders a password input field.
$html
password
(string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
-
string
$key: Input element's name and id
-
string|array
$valueOrArray: Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
-
array
$miscFields: A hash array with html attributes as key/value pairs (possibly including "class")
void
processRequestValue
( $key, [ $type = "post"])
Generates a radio button
void
radio
(string $key, $value, [ $valueOrArray = false], [ $miscFields = array()], string $valueOfButton, string $valueOfSelectedOption)
-
string
$key
-
string
$valueOfButton
-
string
$valueOfSelectedOption
-
$value
-
$valueOrArray
-
$miscFields
Renders a search input field.
$html
search
(string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
-
string
$key: Input element's name and id
-
string|array
$valueOrArray: Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
-
array
$miscFields: A hash array with html attributes as key/value pairs (possibly including "class")
Renders a select field. First argument is the name of the field. Second is an associative array of key => display. Second argument is either the value of the field to be selected (and if it's blank we check post) or a misc. array of fields
$html
select
(string $key, $optionValues, [ $valueOrArray = false], [ $miscFields = array()])
-
string
$key
-
$optionValues
-
$valueOrArray
-
$miscFields
Renders a multiple select box
$html
selectMultiple
(string $key, array $optionValues, [array|string $defaultValues = false], [array $miscFields = array()])
-
string
$key: Select's name and id
-
array
$optionValues: Hash array with name/value as the select's option value/text
-
array|string
$defaultValues: Default value(s) which match with the option values; overridden by $_REQUEST
-
array
$miscFields: A hash array with html attributes as key/value pairs (possibly including "class")
Creates a submit button
void
submit
(string $name, string $value, [array $fields = array()], [ $additionalClasses = ''])
-
string
$name
-
array
$fields: Additional fields appended at the end of the submit button return string $html
-
string
$value: value
-
$additionalClasses
Renders a telephone input field.
$html
telephone
(string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
-
string
$key: Input element's name and id
-
string|array
$valueOrArray: Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
-
array
$miscFields: A hash array with html attributes as key/value pairs (possibly including "class")
Renders a text input field.
$html
text
(string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
-
string
$key: Input element's name and id
-
string|array
$valueOrArray: Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
-
array
$miscFields: A hash array with html attributes as key/value pairs (possibly including "class")
Creates a textarea field. Second argument is either the value of the field (and if it's blank we check post) or a misc. array of fields
string
textarea
(string $key)
Renders a URL input field.
$html
url
(string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
-
string
$key: Input element's name and id
-
string|array
$valueOrArray: Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
-
array
$miscFields: A hash array with html attributes as key/value pairs (possibly including "class")