error() public static method
Generates a tag that contains the first validation error of the specified model attribute.
Note that even if there is no validation error, this method will still return an empty error tag.
public static string error ( $model, $attribute, $options = [] ) | ||
---|---|---|
$model | yii\base\Model |
The model object |
$attribute | string |
The attribute name or expression. See getAttributeName() for the format about attribute expression. |
$options | array |
The tag options in terms of name-value pairs. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. The following options are specially handled:
See renderTagAttributes() for details on how attributes are being rendered. |
return | string |
The generated label tag |
Please login to continue.