Inheritance diagram for FormHelper:

Public Member Functions | |
| __generateOptions ($name, $options=array()) | |
| __name ($options=array(), $field=null, $key= 'name') | |
| __secure ($field=null, $value=null) | |
| __selectOptions ($elements=array(), $selected=null, $parents=array(), $showParents=null, $attributes=array()) | |
| _initInputField ($field, $options=array()) | |
| button ($title, $options=array()) | |
| checkbox ($fieldName, $options=array()) | |
| create ($model=null, $options=array()) | |
| dateTime ($fieldName, $dateFormat= 'DMY', $timeFormat= '12', $selected=null, $attributes=array(), $showEmpty=true) | |
| day ($fieldName, $selected=null, $attributes=array(), $showEmpty=true) | |
| end ($options=null) | |
| error ($field, $text=null, $options=array()) | |
| file ($fieldName, $options=array()) | |
| hidden ($fieldName, $options=array()) | |
| hour ($fieldName, $format24Hours=false, $selected=null, $attributes=array(), $showEmpty=true) | |
| input ($fieldName, $options=array()) | |
| inputs ($fields=null, $blacklist=null) | |
| isFieldError ($field) | |
| label ($fieldName=null, $text=null, $attributes=array()) | |
| meridian ($fieldName, $selected=null, $attributes=array(), $showEmpty=true) | |
| minute ($fieldName, $selected=null, $attributes=array(), $showEmpty=true) | |
| month ($fieldName, $selected=null, $attributes=array(), $showEmpty=true) | |
| password ($fieldName, $options=array()) | |
| radio ($fieldName, $options=array(), $attributes=array()) | |
| secure ($fields=array()) | |
| select ($fieldName, $options=array(), $selected=null, $attributes=array(), $showEmpty= '') | |
| submit ($caption=null, $options=array()) | |
| text ($fieldName, $options=array()) | |
| textarea ($fieldName, $options=array()) | |
| year ($fieldName, $minYear=null, $maxYear=null, $selected=null, $attributes=array(), $showEmpty=true) | |
Public Attributes | |
| $__options | |
| $fields = array() | |
| $fieldset = array('fields' => array(), 'key' => 'id', 'validates' => array()) | |
| $helpers = array('Html') | |
| $requestType = null | |
Definition at line 35 of file form.php.
| FormHelper::__generateOptions | ( | $ | name, | |
| $ | options = array() | |||
| ) |
| FormHelper::__name | ( | $ | options = array(), |
|
| $ | field = null, |
|||
| $ | key = 'name' | |||
| ) |
| FormHelper::__secure | ( | $ | field = null, |
|
| $ | value = null | |||
| ) |
Determine which fields of a form should be used for hash
| mixed | $field Reference to field to be secured | |
| mixed | $value Field value, if value should not be tampered with private |
Definition at line 342 of file form.php.
References Set::filter(), ClassRegistry::getObject(), and params().
| FormHelper::__selectOptions | ( | $ | elements = array(), |
|
| $ | selected = null, |
|||
| $ | parents = array(), |
|||
| $ | showParents = null, |
|||
| $ | attributes = array() | |||
| ) |
Returns an array of formatted OPTION/OPTGROUP elements private
Definition at line 1672 of file form.php.
References camelize(), name(), and underscore().
Referenced by select().
| FormHelper::_initInputField | ( | $ | field, | |
| $ | options = array() | |||
| ) |
Sets field defaults and adds field to form security input hash
Options
| string | $field | |
| array | $options |
Reimplemented from Helper.
Definition at line 1864 of file form.php.
References params().
Referenced by button(), checkbox(), file(), hidden(), password(), radio(), select(), text(), and textarea().
| FormHelper::button | ( | $ | title, | |
| $ | options = array() | |||
| ) |
Creates a button tag.
| string | $title The button's caption | |
| array | $options Array of options. |
Definition at line 1067 of file form.php.
References _initInputField(), name(), Helper::output(), and Helper::value().
| FormHelper::checkbox | ( | $ | fieldName, | |
| $ | options = array() | |||
| ) |
Creates a checkbox input widget.
Options:
| string | $fieldName Name of a field, like this "Modelname.fieldname" | |
| array | $options Array of HTML attributes. |
Definition at line 843 of file form.php.
References $output, _initInputField(), hidden(), name(), Helper::output(), secure(), and Helper::value().
| FormHelper::create | ( | $ | model = null, |
|
| $ | options = array() | |||
| ) |
Returns an HTML FORM element.
Options:
public
| string | $model The model object which the form is being defined for | |
| array | $options An array of html attributes and options. |
Definition at line 89 of file form.php.
References Helper::$data, $fields, $id, $path, Helper::_parseAttributes(), camelize(), Set::countDim(), file(), ClassRegistry::getObject(), hidden(), ClassRegistry::isKeySet(), ClassRegistry::keys(), name(), Helper::output(), params(), pluralize(), Helper::setEntity(), underscore(), Helper::url(), and Helper::value().
| FormHelper::dateTime | ( | $ | fieldName, | |
| $ | dateFormat = 'DMY', |
|||
| $ | timeFormat = '12', |
|||
| $ | selected = null, |
|||
| $ | attributes = array(), |
|||
| $ | showEmpty = true | |||
| ) |
Returns a set of SELECT elements for a full datetime setup: day, month and year, and then time.
Attributes:
| string | $fieldName Prefix name for the SELECT element | |
| string | $dateFormat DMY, MDY, YMD or NONE. | |
| string | $timeFormat 12, 24, NONE | |
| string | $selected Option which is selected. | |
| string | $attributes array of Attributes | |
| bool | $showEmpty Whether or not to show an empty default value. |
Definition at line 1499 of file form.php.
References am(), day(), month(), select(), Helper::value(), and year().
Referenced by input().
| FormHelper::day | ( | $ | fieldName, | |
| $ | selected = null, |
|||
| $ | attributes = array(), |
|||
| $ | showEmpty = true | |||
| ) |
Returns a SELECT element for days.
| string | $fieldName Prefix name for the SELECT element | |
| string | $selected Option which is selected. | |
| array | $attributes HTML attributes for the select element | |
| mixed | $showEmpty Show/hide the empty select option |
Definition at line 1252 of file form.php.
References __generateOptions(), select(), and Helper::value().
Referenced by dateTime().
| FormHelper::end | ( | $ | options = null |
) |
Closes an HTML form, cleans up values set by FormHelper::create(), and writes hidden input fields where appropriate.
If $options is set a form submit button will be created.
| mixed | $options as a string will use $options as the value of button, array usage: array('label' => 'save'); value="save" array('label' => 'save', 'name' => 'Whatever'); value="save" name="Whatever" array('name' => 'Whatever'); value="Submit" name="Whatever" array('label' => 'save', 'name' => 'Whatever', 'div' => 'good') value="save" name="Whatever" array('label' => 'save', 'name' => 'Whatever', 'div' => array('class' => 'good')); value="save" name="Whatever" |
Definition at line 267 of file form.php.
References $out, __(), ClassRegistry::getObject(), label(), Helper::output(), params(), secure(), Helper::setEntity(), and submit().
Referenced by inputs().
| FormHelper::error | ( | $ | field, | |
| $ | text = null, |
|||
| $ | options = array() | |||
| ) |
Returns a formatted error message for given FORM field, NULL if no errors.
Options:
| string | $field A field name, like "Modelname.fieldname" | |
| mixed | $text Error message or array of $options | |
| array | $options Rendering options for wrapper tag |
Definition at line 393 of file form.php.
References __(), Helper::field(), humanize(), Helper::setEntity(), and Helper::tagIsInvalid().
| FormHelper::file | ( | $ | fieldName, | |
| $ | options = array() | |||
| ) |
Creates file input widget.
| string | $fieldName Name of a field, in the form "Modelname.fieldname" | |
| array | $options Array of HTML attributes. |
Definition at line 1046 of file form.php.
References __secure(), _initInputField(), Helper::_parseAttributes(), error(), ClassRegistry::getObject(), name(), Helper::output(), secure(), and size().
| FormHelper::hidden | ( | $ | fieldName, | |
| $ | options = array() | |||
| ) |
Creates a hidden input field.
| string | $fieldName Name of a field, in the form"Modelname.fieldname" | |
| array | $options Array of HTML attributes. |
Definition at line 1016 of file form.php.
References __secure(), _initInputField(), Helper::model(), name(), Helper::output(), secure(), and Helper::value().
Referenced by checkbox(), create(), input(), radio(), secure(), and select().
| FormHelper::hour | ( | $ | fieldName, | |
| $ | format24Hours = false, |
|||
| $ | selected = null, |
|||
| $ | attributes = array(), |
|||
| $ | showEmpty = true | |||
| ) |
Returns a SELECT element for hours.
| string | $fieldName Prefix name for the SELECT element | |
| boolean | $format24Hours True for 24 hours format | |
| string | $selected Option which is selected. | |
| array | $attributes List of HTML attributes | |
| mixed | $showEmpty True to show an empty element, or a string to provide default empty element text |
Definition at line 1373 of file form.php.
References __generateOptions(), select(), and Helper::value().
| FormHelper::input | ( | $ | fieldName, | |
| $ | options = array() | |||
| ) |
Generates a form input element complete with label and wrapper div
Options - See each field type method for more information. Any options that are part of $attributes or $options for the different type methods can be included in $options for input().
| string | $fieldName This should be "Modelname.fieldname" | |
| array | $options Each type of input takes different options. |
Definition at line 575 of file form.php.
References $out, Helper::addClass(), checkbox(), dateTime(), Helper::domId(), error(), Helper::field(), file(), ClassRegistry::getObject(), hidden(), ClassRegistry::isKeySet(), label(), Helper::model(), password(), pluralize(), radio(), select(), Helper::setEntity(), text(), textarea(), and variable().
| FormHelper::inputs | ( | $ | fields = null, |
|
| $ | blacklist = null | |||
| ) |
Will display all the fields passed in an array expects fieldName as an array key replaces generateFields
public
| array | $fields works well with Controller::generateFields() or on its own; | |
| array | $blacklist a simple array of fields to skip |
Definition at line 486 of file form.php.
References $fields, $fieldset, $out, __(), end(), false, humanize(), input(), Helper::model(), and underscore().
| FormHelper::isFieldError | ( | $ | field | ) |
Returns true if there is an error for the given field, otherwise false
| string | $field This should be "Modelname.fieldname" |
Definition at line 373 of file form.php.
References Helper::setEntity(), and Helper::tagIsInvalid().
| FormHelper::label | ( | $ | fieldName = null, |
|
| $ | text = null, |
|||
| $ | attributes = array() | |||
| ) |
Returns a formatted LABEL element for HTML FORMs.
| string | $fieldName This should be "Modelname.fieldname" | |
| string | $text Text that will appear in the label field. | |
| array | $attributes Array of HTML attributes. |
Definition at line 446 of file form.php.
References __(), Helper::domId(), ClassRegistry::getObject(), humanize(), Helper::output(), and underscore().
| FormHelper::meridian | ( | $ | fieldName, | |
| $ | selected = null, |
|||
| $ | attributes = array(), |
|||
| $ | showEmpty = true | |||
| ) |
Returns a SELECT element for AM or PM.
| string | $fieldName Prefix name for the SELECT element | |
| string | $selected Option which is selected. | |
| string | $attributes Array of Attributes | |
| bool | $showEmpty Show/Hide an empty option |
Definition at line 1456 of file form.php.
References __generateOptions(), select(), and Helper::value().
| FormHelper::minute | ( | $ | fieldName, | |
| $ | selected = null, |
|||
| $ | attributes = array(), |
|||
| $ | showEmpty = true | |||
| ) |
Returns a SELECT element for minutes.
| string | $fieldName Prefix name for the SELECT element | |
| string | $selected Option which is selected. | |
| string | $attributes Array of Attributes | |
| bool | $showEmpty True to show an empty element, or a string to provide default empty element text |
Definition at line 1415 of file form.php.
References __generateOptions(), select(), and Helper::value().
| FormHelper::month | ( | $ | fieldName, | |
| $ | selected = null, |
|||
| $ | attributes = array(), |
|||
| $ | showEmpty = true | |||
| ) |
Returns a SELECT element for months.
Attributes:
| string | $fieldName Prefix name for the SELECT element | |
| string | $selected Option which is selected. | |
| array | $attributes Attributes for the select element | |
| boolean | $showEmpty Show/hide the empty select option |
Definition at line 1331 of file form.php.
References __generateOptions(), select(), and Helper::value().
Referenced by dateTime().
| FormHelper::password | ( | $ | fieldName, | |
| $ | options = array() | |||
| ) |
Creates a password input widget.
| string | $fieldName Name of a field, like in the form "Modelname.fieldname" | |
| array | $options Array of HTML attributes. |
Definition at line 975 of file form.php.
References _initInputField(), name(), and Helper::output().
Referenced by input().
| FormHelper::radio | ( | $ | fieldName, | |
| $ | options = array(), |
|||
| $ | attributes = array() | |||
| ) |
Creates a set of radio widgets.
Attributes:
| string | $fieldName Name of a field, like this "Modelname.fieldname" | |
| array | $options Radio button options array. | |
| array | $attributes Array of HTML attributes. |
Definition at line 882 of file form.php.
References $out, __(), _initInputField(), Helper::_parseAttributes(), camelize(), Helper::field(), hidden(), humanize(), label(), name(), Helper::output(), underscore(), and Helper::value().
Referenced by input().
| FormHelper::secure | ( | $ | fields = array() |
) |
Generates a hidden field with a security hash based on the fields used in the form.
| array | $fields The list of fields to use when generating the hash |
Definition at line 309 of file form.php.
References $fields, $out, Security::hash(), hidden(), params(), Configure::read(), and Helper::value().
Referenced by checkbox(), end(), file(), hidden(), and select().
| FormHelper::select | ( | $ | fieldName, | |
| $ | options = array(), |
|||
| $ | selected = null, |
|||
| $ | attributes = array(), |
|||
| $ | showEmpty = '' | |||
| ) |
Returns a formatted SELECT element.
Attributes:
| string | $fieldName Name attribute of the SELECT | |
| array | $options Array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the SELECT element | |
| mixed | $selected The option selected by default. If null, the default value from POST data will be used when available. | |
| array | $attributes The HTML attributes of the select element. | |
| mixed | $showEmpty If true, the empty select option is shown. If a string, that string is displayed as the empty element. |
Definition at line 1170 of file form.php.
References __generateOptions(), __secure(), __selectOptions(), _initInputField(), Helper::_parseAttributes(), checkbox(), hidden(), name(), Helper::output(), secure(), and Helper::value().
Referenced by dateTime(), day(), hour(), input(), meridian(), minute(), month(), and year().
| FormHelper::submit | ( | $ | caption = null, |
|
| $ | options = array() | |||
| ) |
Creates a submit button element.
| string | $caption The label appearing on the button OR if string contains :// or the extension .jpg, .jpe, .jpeg, .gif, .png use an image if the extension exists, AND the first character is /, image is relative to webroot, OR if the first character is not /, image is relative to webroot/img. | |
| array | $options |
Definition at line 1094 of file form.php.
References $out, __(), and Helper::output().
Referenced by end().
| FormHelper::text | ( | $ | fieldName, | |
| $ | options = array() | |||
| ) |
Creates a text input widget.
| string | $fieldName Name of a field, in the form "Modelname.fieldname" | |
| array | $options Array of HTML attributes. |
Definition at line 958 of file form.php.
References _initInputField(), input(), name(), and Helper::output().
Referenced by input().
| FormHelper::textarea | ( | $ | fieldName, | |
| $ | options = array() | |||
| ) |
Creates a textarea widget.
| string | $fieldName Name of a field, in the form "Modelname.fieldname" | |
| array | $options Array of HTML attributes. |
Definition at line 990 of file form.php.
References _initInputField(), name(), Helper::output(), and Helper::value().
Referenced by input().
| FormHelper::year | ( | $ | fieldName, | |
| $ | minYear = null, |
|||
| $ | maxYear = null, |
|||
| $ | selected = null, |
|||
| $ | attributes = array(), |
|||
| $ | showEmpty = true | |||
| ) |
Returns a SELECT element for years
| string | $fieldName Prefix name for the SELECT element | |
| integer | $minYear First year in sequence | |
| integer | $maxYear Last year in sequence | |
| string | $selected Option which is selected. | |
| array | $attributes Attribute array for the select elements. | |
| boolean | $showEmpty Show/hide the empty select option |
Definition at line 1288 of file form.php.
References __generateOptions(), select(), and Helper::value().
Referenced by dateTime().
| FormHelper::$__options |
| FormHelper::$fields = array() |
| FormHelper::$fieldset = array('fields' => array(), 'key' => 'id', 'validates' => array()) |
| FormHelper::$helpers = array('Html') |
1.4.7