Property |
Type |
Description |
|
$action |
array | string |
the form action URL. This parameter will be processed by [[\yii\helpers\Url::to()]]. |
|
$ajaxDataType |
|
the type of data that you're expecting back from the server. |
|
$ajaxParam |
|
the name of the GET parameter indicating the validation request is an AJAX request. |
|
$attributes |
|
the client validation options for individual attributes. Each element of the array
represents the validation options for a particular attribute. |
|
$enableAjaxValidation |
|
whether to enable AJAX-based data validation.
If [[ActiveField::enableAjaxValidation]] is set, its value will take precedence for that input field. |
|
$enableClientScript |
|
whether to hook up yii.activeForm JavaScript plugin.
This property must be set true if you want to support client validation and/or AJAX validation, or if you
want to take advantage of the yii.activeForm plugin. When this is false, the form will not generate
any JavaScript. |
|
$enableClientValidation |
|
whether to enable client-side data validation.
If [[ActiveField::enableClientValidation]] is set, its value will take precedence for that input field. |
|
$encodeErrorSummary |
|
whether to perform encoding on the error summary. |
|
$errorCssClass |
|
the CSS class that is added to a field container when the associated attribute has validation error. |
|
$errorSummaryCssClass |
|
the default CSS class for the error summary container. |
|
$fieldClass |
|
the default field class name when calling ActiveForm::field to create a new field. |
|
$fieldConfig |
|
the default configuration used by ActiveForm::field when creating a new field object.
This can be either a configuration array or an anonymous function returning a configuration array.
If the latter, the signature should be as follows:
php
function ($model, $attribute)
The value of this property will be merged recursively with the $options parameter passed to ActiveForm::field. |
|
$method |
|
the form submission method. This should be either post or get. Defaults to post.
When you set this to get you may see the url parameters repeated on each request.
This is because the default value of [[action]] is set to be the current request url and each submit
will add new parameters instead of replacing existing ones.
You may set [[action]] explicitly to avoid this:
php
$form = ActiveForm::begin([
'method' => 'get',
'action' => ['controller/action'],
]);
|
|
$options |
|
the HTML attributes (name-value pairs) for the form tag. |
|
$requiredCssClass |
|
the CSS class that is added to a field container when the associated attribute is required. |
|
$scrollToError |
|
whether to scroll to the first error after validation. |
|
$scrollToErrorOffset |
|
offset in pixels that should be added when scrolling to the first error. |
|
$successCssClass |
|
the CSS class that is added to a field container when the associated attribute is successfully validated. |
|
$validateOnBlur |
|
whether to perform validation when an input field loses focus.
If [[ActiveField::$validateOnBlur]] is set, its value will take precedence for that input field. |
|
$validateOnChange |
|
whether to perform validation when the value of an input field is changed.
If [[ActiveField::validateOnChange]] is set, its value will take precedence for that input field. |
|
$validateOnSubmit |
|
whether to perform validation when the form is submitted. |
|
$validateOnType |
|
whether to perform validation while the user is typing in an input field.
If [[ActiveField::validateOnType]] is set, its value will take precedence for that input field. |
|
$validatingCssClass |
|
the CSS class that is added to a field container when the associated attribute is being validated. |
|
$validationDelay |
|
number of milliseconds that the validation should be delayed when the user types in the field
and [[validateOnType]] is set true.
If [[ActiveField::validationDelay]] is set, its value will take precedence for that input field. |
|
$validationUrl |
|
the URL for performing AJAX-based validation. This property will be processed by
[[Url::to()]]. Please refer to [[Url::to()]] for more details on how to configure this property.
If this property is not set, it will take the value of the form's action attribute. |
|