TYPE_VERTICAL
TYPE_VERTICAL
This class is extended version of {@link CActiveForm}, that allows you fully take advantage of bootstrap forms.
Basically form consists of control groups with label, field, error info, hint text and other useful stuff. TbActiveForm brings together all of these things to quickly build custom forms even with non-standard fields.
Each field method has $options for customizing rendering appearance.
Here's simple example how to build login form using this class:
beginWidget('booster.widgets.TbActiveForm', array( 'type' => 'horizontal', 'htmlOptions' => array('class' => 'well'), )); ?> errorSummary($model); ?> textFieldGroup($model, 'username'); ?> passwordFieldGroup($model, 'password', array(), array( 'hint' => 'Check keyboard layout' )); ?> checkboxGroup($model, 'rememberMe'); ?>'btn')); ?>endWidget(); ?>
Additionally this class provides two additional ways to render custom widget or field or even everything you want
with {@link TbActiveForm::widgetGroup} and {@link TbActiveForm::customFieldGroup}.
Examples are simply clear:
$form->widgetGroup(
'my.super.cool.widget',
array('model' => $model, 'attribute' => $attribute, 'data' => $mydata),
array('hint' => 'Hint text here!')
);
// suppose that field is rendered via SomeClass::someMethod($model, $attribute) call. $form->customFieldGroup(
array(array('SomeClass', 'someMethod'), array($model, $attribute)),
$mode,
$attribute,
array(...)
);
errorSummary(mixed $models, string $header, string $footer, array $htmlOptions) : string
Displays a summary of validation errors for one or several models.
This method is a wrapper for {@link CActiveForm::errorSummary}.
mixed | $models | The models whose input errors are to be displayed. This can be either a single model or an array of models. |
string | $header | A piece of HTML code that appears in front of the errors |
string | $footer | A piece of HTML code that appears at the end of the errors |
array | $htmlOptions | Additional HTML attributes to be rendered in the container div tag. |
The error summary. Empty if no errors are found.
urlFieldGroup(\CModel $model, string $attribute, array $options) : string
Generates a url field group for a model attribute.
This method is a wrapper for {@link CActiveForm::urlField} and {@link customFieldGroup}. Please check {@link CActiveForm::urlField} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated url field group.
emailFieldGroup(\CModel $model, string $attribute, array $options) : string
Generates an email field group for a model attribute.
This method is a wrapper for {@link CActiveForm::emailField} and {@link customFieldGroup}. Please check {@link CActiveForm::emailField} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
the generated email field group.
numberFieldGroup(\CModel $model, string $attribute, array $options) : string
Generates a number field group for a model attribute.
This method is a wrapper for {@link CActiveForm::numberField} and {@link customFieldGroup}. Please check {@link CActiveForm::numberField} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated number filed group.
rangeFieldGroup(\CModel $model, string $attribute, array $options) : string
Generates a range field group for a model attribute.
This method is a wrapper for {@link CActiveForm::rangeField} and {@link customFieldGroup}. Please check {@link CActiveForm::rangeField} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated range field group.
dateFieldGroup(\CModel $model, string $attribute, array $options) : string
Generates a date field group for a model attribute.
This method is a wrapper for {@link CActiveForm::dateField} and {@link customFieldGroup}. Please check {@link CActiveForm::dateField} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated date field group.
timeFieldGroup(\CModel $model, string $attribute, array $options) : string
Generates a time field group for a model attribute.
This method is a wrapper for {@link CActiveForm::timeField} and {@link customFieldGroup}. Please check {@link CActiveForm::timeField} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated date field group.
telFieldGroup(\CModel $model, string $attribute, array $options) : string
Generates a tel field group for a model attribute.
This method is a wrapper for {@link CActiveForm::telField} and {@link customFieldGroup}. Please check {@link CActiveForm::telField} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated date field group.
textFieldGroup(\CModel $model, string $attribute, array $options) : string
Generates a text field group for a model attribute.
This method is a wrapper for {@link CActiveForm::textField} and {@link customFieldGroup}. Please check {@link CActiveForm::textField} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated text field group.
searchFieldGroup(\CModel $model, string $attribute, array $options) : string
Generates a search field group for a model attribute.
This method is a wrapper for {@link CActiveForm::searchField} and {@link customFieldGroup}. Please check {@link CActiveForm::searchField} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated text field group.
passwordFieldGroup(\CModel $model, string $attribute, array $options) : string
Generates a password field group for a model attribute.
This method is a wrapper for {@link CActiveForm::passwordField} and {@link customFieldGroup}. Please check {@link CActiveForm::passwordField} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated password field group.
textAreaGroup(\CModel $model, string $attribute, array $options) : string
Generates a text area group for a model attribute.
This method is a wrapper for {@link CActiveForm::textArea} and {@link customFieldGroup}. Please check {@link CActiveForm::textArea} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated text area group.
fileFieldGroup(\CModel $model, string $attribute, array $options) : string
Generates a file field group for a model attribute.
This method is a wrapper for {@link CActiveForm::fileField} and {@link customFieldGroup}. Please check {@link CActiveForm::fileField} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated file field group.
radioButtonGroup(\CModel $model, string $attribute, array $options) : string
Generates a radio button group for a model attribute.
This method is a wrapper for {@link CActiveForm::radioButton} and {@link customFieldGroup}. Please check {@link CActiveForm::radioButton} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated radio button group.
checkboxGroup(\CModel $model, string $attribute, array $options) : string
Generates a checkbox group for a model attribute.
This method is a wrapper for {@link CActiveForm::checkbox} and {@link customFieldGroup}. Please check {@link CActiveForm::checkbox} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated checkbox group.
dropDownListGroup(\CModel $model, string $attribute, array $options) : string
Generates a dropdown list group for a model attribute.
This method is a wrapper for {@link CActiveForm::dropDownList} and {@link customFieldGroup}. Please check {@link CActiveForm::dropDownList} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated drop down list group.
listBoxGroup(\CModel $model, string $attribute, array $options) : string
Generates a list box group for a model attribute.
This method is a wrapper for {@link CActiveForm::listBox} and {@link customFieldGroup}. Please check {@link CActiveForm::listBox} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated list box group.
checkboxListGroup(\CModel $model, string $attribute, array $options) : string
Generates a checkbox list group for a model attribute.
This method is a wrapper for {@link CActiveForm::checkboxList} and {@link customFieldGroup}. Please check {@link CActiveForm::checkboxList} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated checkbox list group.
radioButtonListGroup(\CModel $model, string $attribute, array $options) : string
Generates a radio button list group for a model attribute.
This method is a wrapper for {@link CActiveForm::radioButtonList} and {@link customFieldGroup}. Please check {@link CActiveForm::radioButtonList} for detailed information about $htmlOptions argument. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated radio button list group.
switchGroup(\CModel $model, string $attribute, array $options) : string
Generates a toggle button group for a model attribute.
This method is a wrapper for {@link TbToggleButton} widget and {@link customFieldGroup}. Please check {@link TbToggleButton} documentation for detailed information about $widgetOptions. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated toggle button group.
datePickerGroup(\CModel $model, string $attribute, array $options) : string
Generates a date picker group for a model attribute.
This method is a wrapper for {@link TbDatePicker} widget and {@link customFieldGroup}. Please check {@link TbDatePicker} documentation for detailed information about $widgetOptions. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated date picker group.
dateRangeGroup(\CModel $model, string $attribute, array $options) : string
Generates a date range picker group for a model attribute.
This method is a wrapper for {@link TbDateRangePicker} widget and {@link customFieldGroup}. Please check {@link TbDateRangePicker} documentation for detailed information about $widgetOptions. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated date range picker group.
timePickerGroup(\CModel $model, string $attribute, array $options) : string
Generates a time picker group for a model attribute.
This method is a wrapper for {@link TbTimePicker} widget and {@link customFieldGroup}. Please check {@link TbTimePicker} documentation for detailed information about $widgetOptions. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated time picker group.
dateTimePickerGroup(\CModel $model, string $attribute, array $options) : string
Generates a date-time picker group for a model attribute.
This method is a wrapper for {@link TbDateTimePicker} widget and {@link customFieldGroup}. Please check {@link TbDateTimePicker} documentation for detailed information about $widgetOptions. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated date-time picker group.
select2Group(\CModel $model, string $attribute, array $options) : string
Generates a select2 group for a model attribute.
This method is a wrapper for {@link TbSelect2} widget and {@link customFieldGroup}. Please check {@link TbSelect2} documentation for detailed information about $widgetOptions. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated select2 group.
redactorGroup(\CModel $model, string $attribute, array $options) : string
Generates a redactor editor group for a model attribute.
This method is a wrapper for {@link TbRedactorJs} widget and {@link customFieldGroup}. Please check {@link TbRedactorJs} documentation for detailed information about $widgetOptions. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated redactor editor group.
html5EditorGroup(\CModel $model, string $attribute, array $options) : string
Generates a html5 editor group for a model attribute.
This method is a wrapper for {@link TbHtml5Editor} widget and {@link customFieldGroup}. Please check {@link TbHtml5Editor} documentation for detailed information about $widgetOptions. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated html5 editor group.
markdownEditorGroup(\CModel $model, string $attribute, array $options) : string
Generates a markdown editor group for a model attribute.
This method is a wrapper for {@link TbMarkdownEditorJs} widget and {@link customFieldGroup}. Please check {@link TbMarkdownEditorJs} documentation for detailed information about $widgetOptions. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated markdown editor group.
ckEditorGroup(\CModel $model, string $attribute, array $options) : string
Generates a CKEditor group for a model attribute.
This method is a wrapper for {@link TbCKEditor} widget and {@link customFieldGroup}. Please check {@link TbCKEditor} documentation for detailed information about $widgetOptions. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated CKEditor group.
typeAheadGroup(\CModel $model, string $attribute, array $options) : string
Generates a type-ahead group for a model attribute.
This method is a wrapper for {@link TbTypeahead} widget and {@link customFieldGroup}. Please check {@link TbTypeahead} documentation for detailed information about $widgetOptions. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated type-ahead group.
maskedTextFieldGroup(\CModel $model, string $attribute, array $options) : string
Generates a masked text field group for a model attribute.
This method is a wrapper for {@link CMaskedTextField} widget and {@link customFieldGroup}. Please check {@link CMaskedTextField} documentation for detailed information about $widgetOptions. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated masked text field group.
colorPickerGroup(\CModel $model, string $attribute, array $options) : string
Generates a color picker field group for a model attribute.
This method is a wrapper for {@link TbColorPicker} widget and {@link customFieldGroup}. Please check {@link TbColorPicker} documentation for detailed information about $widgetOptions. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated color picker group.
captchaGroup(\CModel $model, string $attribute, array $htmlOptions, array $options) : string
Generates a color picker field group for a model attribute.
This method is a wrapper for {@link CCaptcha} widget, {@link textField} and {@link customFieldGroup}. Please check {@link CCaptcha} documentation for detailed information about $widgetOptions. Read detailed information about $htmlOptions in {@link CActiveForm::textField} method. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $htmlOptions | Additional HTML attributes for captcha text field. |
array | $options | Group attributes. |
The generated color picker group.
passFieldGroup(\CModel $model, string $attribute, array $options) : string
Generates a Pass*Field group for a model attribute.
This method is a wrapper for {@link TbPassfield} widget and {@link customFieldGroup}. Please check {@link TbPassfield} documentation for detailed information about $widgetOptions. About $options argument parameters see {@link TbActiveForm} documentation.
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated color picker group.
customFieldGroup(array|string $fieldData, \CModel $model, string $attribute, array $options) : string
Generates a custom field group for a model attribute.
About $options argument parameters see {@link TbActiveForm} documentation.
array|string | $fieldData | Pre-rendered field as string or array of arguments for call_user_func_array() function. |
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated custom filed group.
widgetGroup(string $className, \CModel $model, string $attribute, array $options) : string
Generates a widget group for a model attribute.
This method is a wrapper for {@link CBaseController::widget} and {@link customFieldGroup}. Read detailed information about $widgetOptions in $properties argument of {@link CBaseController::widget} method. About $options argument parameters see {@link TbActiveForm} documentation.
string | $className | The widget class name or class in dot syntax (e.g. application.widgets.MyWidget). |
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | List of initial property values for the group (Property Name => Property Value). |
The generated widget group.
widgetGroupInternal(string $className, \CModel $model, string $attribute, array $options) : string
This is a intermediate method for widget-based group methods.
string | $className | The widget class name or class in dot syntax (e.g. application.widgets.MyWidget). |
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
The generated widget group.
customFieldGroupInternal(array|string $fieldData, \CModel $model, string $attribute, array $options) : string
Generates a custom field group for a model attribute.
It's base function for generating group with field.
array|string | $fieldData | Pre-rendered field as string or array of arguments for call_user_func_array() function. |
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Group attributes. |
Raised on invalid form type.
The generated custom filed group.
horizontalGroup(array|string $fieldData, \CModel $model, string $attribute, array $options)
Renders a horizontal custom field group for a model attribute.
array|string | $fieldData | Pre-rendered field as string or array of arguments for call_user_func_array() function. |
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Row options. |
verticalGroup(array|string $fieldData, \CModel $model, string $attribute, array $options)
Renders a vertical custom field group for a model attribute.
array|string | $fieldData | Pre-rendered field as string or array of arguments for call_user_func_array() function. |
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Row options. |
inlineGroup(array|string $fieldData, \CModel $model, string $attribute, array $options)
Renders a inline custom field group for a model attribute.
array|string | $fieldData | Pre-rendered field as string or array of arguments for call_user_func_array() function. |
\CModel | $model | The data model. |
string | $attribute | The attribute. |
array | $options | Row options. |