TbActiveForm
extends CActiveForm
in package
Bootstrap active form widget.
Table of Contents
Properties
- $controlWidthClass : string
- $errorMessageCssClass : string
- $helpType : string
- $hideInlineErrors : bool
- $labelWidthClass : string
- $layout : string
- $successMessageCssClass : string
Methods
- checkBox() : string
- Generates a checkbox for a model attribute.
- checkBoxControlGroup() : string
- Generates a control group with a check box for a model attribute.
- checkBoxList() : string
- Generates a checkbox list for a model attribute.
- checkBoxListControlGroup() : string
- Generates a control group with a check box list for a model attribute.
- copyId() : null
- createControlGroup() : string
- Generates a control group for a model attribute.
- createFormActions() : string
- Generates the form actions container (i.e. submit button, etc).
- createInput() : string
- Generates an input for a model attribute.
- customControlGroup() : string
- Generates a control group with a custom (pre-rendered) input for a model attribute.
- dateField() : string
- Generates a date field for a model attribute.
- dateFieldControlGroup() : string
- Generates a control group with a date field for a model attribute.
- dropDownList() : string
- Generates a dropdown list for a model attribute.
- dropDownListControlGroup() : string
- Generates a control group with a drop down list for a model attribute.
- emailField() : string
- Generates an email field for a model attribute.
- emailFieldControlGroup() : string
- Generates a control group with an email field for a model attribute.
- error() : string
- Displays the first validation error for a model attribute.
- errorSummary() : string
- Displays a summary of validation errors for one or several models.
- fileField() : string
- Generates a file field for a model attribute.
- fileFieldControlGroup() : string
- Generates a control group with a file field for a model attribute.
- init() : mixed
- Initializes the widget.
- inlineCheckBoxList() : string
- Generates an inline checkbox list for a model attribute.
- inlineCheckBoxListControlGroup() : string
- Generates a control group with an inline check box list for a model attribute.
- inlineRadioButtonList() : string
- Generates an inline radio button list for a model attribute
- inlineRadioButtonListControlGroup() : string
- Generates a control group with an inline radio button list for a model attribute.
- listBox() : string
- Generates a list box for a model attribute.
- listBoxControlGroup() : string
- Generates a control group with a list box for a model attribute.
- numberField() : string
- Generates a number field for a model attribute.
- numberFieldControlGroup() : string
- Generates a control group with a number field for a model attribute.
- passwordField() : string
- Generates a password field for a model attribute.
- passwordFieldControlGroup() : string
- Generates a control group with a password field for a model attribute.
- radioButton() : string
- Generates a radio button for a model attribute.
- radioButtonControlGroup() : string
- Generates a control group with a radio button for a model attribute.
- radioButtonList() : string
- Generates a radio button list for a model attribute
- radioButtonListControlGroup() : string
- Generates a control group with a radio button list for a model attribute.
- rangeField() : string
- Generates a range field for a model attribute.
- rangeFieldControlGroup() : string
- Generates a control group with a range field for a model attribute.
- searchQuery() : string
- Generates a search query field for a model attribute.
- searchQueryControlGroup() : string
- Generates a control group with a search field for a model attribute.
- textArea() : string
- Generates a text area for a model attribute.
- textAreaControlGroup() : string
- Generates a control group with a text area for a model attribute.
- textField() : string
- Generates a text field for a model attribute.
- textFieldControlGroup() : string
- Generates a control group with a text field for a model attribute.
- uneditableField() : string
- Generates an uneditable field for a model attribute.
- uneditableFieldControlGroup() : string
- Generates a control group with an uneditable field for a model attribute.
- urlField() : string
- Generates an url field for a model attribute.
- urlFieldControlGroup() : string
- Generates a control group with an url field for a model attribute.
- processControlGroupOptions() : array<string|int, mixed>
- Processes the options for a input row.
Properties
$controlWidthClass
public
string
$controlWidthClass
= 'col-sm-10'
class width control for horizontal forms.
$errorMessageCssClass
public
string
$errorMessageCssClass
= 'error'
the CSS class name for error messages.
$helpType
public
string
$helpType
= \TbHtml::HELP_TYPE_BLOCK
the help type. Valid values are TbHtml::HELP_INLINE and TbHtml::HELP_BLOCK.
$hideInlineErrors
public
bool
$hideInlineErrors
= \false
whether to hide inline errors. Defaults to false.
$labelWidthClass
public
string
$labelWidthClass
= 'col-sm-2'
class width label for horizontal forms.
$layout
public
string
$layout
the form layout.
$successMessageCssClass
public
string
$successMessageCssClass
= 'success'
the CSS class name for success messages.
Methods
checkBox()
Generates a checkbox for a model attribute.
public
checkBox(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated check box.
checkBoxControlGroup()
Generates a control group with a check box for a model attribute.
public
checkBoxControlGroup(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
checkBoxList()
Generates a checkbox list for a model attribute.
public
checkBoxList(CModel $model, string $attribute, array<string|int, mixed> $data[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $data : array<string|int, mixed>
-
data for generating the list options (value=>display)
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated checkbox list.
checkBoxListControlGroup()
Generates a control group with a check box list for a model attribute.
public
checkBoxListControlGroup(CModel $model, string $attribute, array<string|int, mixed> $data[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $data : array<string|int, mixed>
-
data for generating the list options (value=>display).
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
copyId()
public
copyId() : null
via TbWidget
Return values
nullcreateControlGroup()
Generates a control group for a model attribute.
public
createControlGroup(string $type, CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ][, array<string|int, mixed> $data = array() ]) : string
Parameters
- $type : string
-
the input type.
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
- $data : array<string|int, mixed> = array()
-
data for generating the list options (value=>display).
Tags
Return values
string —the generated control group.
createFormActions()
Generates the form actions container (i.e. submit button, etc).
public
createFormActions(mixed $actions[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $actions : mixed
-
the actions.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Return values
stringcreateInput()
Generates an input for a model attribute.
public
createInput(string $type, CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ][, array<string|int, mixed> $data = array() ]) : string
Parameters
- $type : string
-
the input type.
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
- $data : array<string|int, mixed> = array()
-
data for generating the list options (value=>display).
Tags
Return values
string —the generated input.
customControlGroup()
Generates a control group with a custom (pre-rendered) input for a model attribute.
public
customControlGroup(string $input, CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $input : string
-
the rendered input.
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
dateField()
Generates a date field for a model attribute.
public
dateField(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Return values
string —the generated input field.
dateFieldControlGroup()
Generates a control group with a date field for a model attribute.
public
dateFieldControlGroup(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
dropDownList()
Generates a dropdown list for a model attribute.
public
dropDownList(CModel $model, string $attribute, array<string|int, mixed> $data[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $data : array<string|int, mixed>
-
data for generating the list options (value=>display).
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated drop down list.
dropDownListControlGroup()
Generates a control group with a drop down list for a model attribute.
public
dropDownListControlGroup(CModel $model, string $attribute, array<string|int, mixed> $data[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $data : array<string|int, mixed>
-
data for generating the list options (value=>display).
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
emailField()
Generates an email field for a model attribute.
public
emailField(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated input field.
emailFieldControlGroup()
Generates a control group with an email field for a model attribute.
public
emailFieldControlGroup(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
error()
Displays the first validation error for a model attribute.
public
error(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ][, bool $enableAjaxValidation = true ][, bool $enableClientValidation = true ]) : string
Parameters
- $model : CModel
-
the data model
- $attribute : string
-
the attribute name
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes to be rendered in the container div tag.
- $enableAjaxValidation : bool = true
-
whether to enable AJAX validation for the specified attribute.
- $enableClientValidation : bool = true
-
whether to enable client-side validation for the specified attribute.
Return values
string —the validation result (error display or success message).
errorSummary()
Displays a summary of validation errors for one or several models.
public
errorSummary(mixed $models[, string $header = null ][, string $footer = null ][, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $models : mixed
-
the models whose input errors are to be displayed.
- $header : string = null
-
a piece of HTML code that appears in front of the errors
- $footer : string = null
-
a piece of HTML code that appears at the end of the errors
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes to be rendered in the container div tag.
Return values
string —the error summary. Empty if no errors are found.
fileField()
Generates a file field for a model attribute.
public
fileField(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes
Tags
Return values
string —the generated input field.
fileFieldControlGroup()
Generates a control group with a file field for a model attribute.
public
fileFieldControlGroup(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
init()
Initializes the widget.
public
init() : mixed
inlineCheckBoxList()
Generates an inline checkbox list for a model attribute.
public
inlineCheckBoxList(CModel $model, string $attribute, array<string|int, mixed> $data[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $data : array<string|int, mixed>
-
data for generating the list options (value=>display)
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated checkbox list.
inlineCheckBoxListControlGroup()
Generates a control group with an inline check box list for a model attribute.
public
inlineCheckBoxListControlGroup(CModel $model, string $attribute, array<string|int, mixed> $data[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $data : array<string|int, mixed>
-
data for generating the list options (value=>display).
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
inlineRadioButtonList()
Generates an inline radio button list for a model attribute
public
inlineRadioButtonList(CModel $model, string $attribute, array<string|int, mixed> $data[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $data : array<string|int, mixed>
-
data for generating the list options (value=>display)
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated radio button list.
inlineRadioButtonListControlGroup()
Generates a control group with an inline radio button list for a model attribute.
public
inlineRadioButtonListControlGroup(CModel $model, string $attribute, array<string|int, mixed> $data[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $data : array<string|int, mixed>
-
data for generating the list options (value=>display).
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
listBox()
Generates a list box for a model attribute.
public
listBox(CModel $model, string $attribute, array<string|int, mixed> $data[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $data : array<string|int, mixed>
-
data for generating the list options (value=>display).
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated list box.
listBoxControlGroup()
Generates a control group with a list box for a model attribute.
public
listBoxControlGroup(CModel $model, string $attribute, array<string|int, mixed> $data[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $data : array<string|int, mixed>
-
data for generating the list options (value=>display).
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
numberField()
Generates a number field for a model attribute.
public
numberField(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated input field.
numberFieldControlGroup()
Generates a control group with a number field for a model attribute.
public
numberFieldControlGroup(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
passwordField()
Generates a password field for a model attribute.
public
passwordField(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated input field.
passwordFieldControlGroup()
Generates a control group with a password field for a model attribute.
public
passwordFieldControlGroup(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
radioButton()
Generates a radio button for a model attribute.
public
radioButton(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated radio button.
radioButtonControlGroup()
Generates a control group with a radio button for a model attribute.
public
radioButtonControlGroup(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
radioButtonList()
Generates a radio button list for a model attribute
public
radioButtonList(CModel $model, string $attribute, array<string|int, mixed> $data[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $data : array<string|int, mixed>
-
data for generating the list options (value=>display)
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated radio button list.
radioButtonListControlGroup()
Generates a control group with a radio button list for a model attribute.
public
radioButtonListControlGroup(CModel $model, string $attribute, array<string|int, mixed> $data[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $data : array<string|int, mixed>
-
data for generating the list options (value=>display).
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
rangeField()
Generates a range field for a model attribute.
public
rangeField(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated input field.
rangeFieldControlGroup()
Generates a control group with a range field for a model attribute.
public
rangeFieldControlGroup(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
searchQuery()
Generates a search query field for a model attribute.
public
searchQuery(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated input.
searchQueryControlGroup()
Generates a control group with a search field for a model attribute.
public
searchQueryControlGroup(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
textArea()
Generates a text area for a model attribute.
public
textArea(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated text area.
textAreaControlGroup()
Generates a control group with a text area for a model attribute.
public
textAreaControlGroup(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
textField()
Generates a text field for a model attribute.
public
textField(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated input field.
textFieldControlGroup()
Generates a control group with a text field for a model attribute.
public
textFieldControlGroup(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
uneditableField()
Generates an uneditable field for a model attribute.
public
uneditableField(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated field.
uneditableFieldControlGroup()
Generates a control group with an uneditable field for a model attribute.
public
uneditableFieldControlGroup(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
urlField()
Generates an url field for a model attribute.
public
urlField(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model
- $attribute : string
-
the attribute
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated input field
urlFieldControlGroup()
Generates a control group with an url field for a model attribute.
public
urlFieldControlGroup(CModel $model, string $attribute[, array<string|int, mixed> $htmlOptions = array() ]) : string
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $htmlOptions : array<string|int, mixed> = array()
-
additional HTML attributes.
Tags
Return values
string —the generated control group.
processControlGroupOptions()
Processes the options for a input row.
protected
processControlGroupOptions(CModel $model, string $attribute, array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
- $model : CModel
-
the data model.
- $attribute : string
-
the attribute name.
- $options : array<string|int, mixed>
-
the options.
Return values
array<string|int, mixed> —the processed options.