validators\RequiredValidator clientValidateAttribute()

clientValidateAttribute() public method Returns the JavaScript needed for performing client-side validation. You may override this method to return the JavaScript validation code if the validator can support client-side validation. The following JavaScript variables are predefined and can be used in the validation code: attribute: an object describing the the attribute being validated. value: the value being validated. messages: an array used to hold the validation error messages for the

validators\RequiredValidator $strict

$strict public property Whether the comparison between the attribute value and $requiredValue is strict. When this is true, both the values and types must match. Defaults to false, meaning only the values need to match. Note that when $requiredValue is null, if this property is true, the validator will check if the attribute value is null; If this property is false, the validator will call isEmpty() to check if the attribute value is empty. public boolean $strict = false

validators\RequiredValidator $skipOnEmpty

$skipOnEmpty public property Whether to skip this validator if the value being validated is empty. public boolean $skipOnEmpty = false

validators\RequiredValidator $requiredValue

$requiredValue public property The desired value that the attribute must have. If this is null, the validator will validate that the specified attribute is not empty. If this is set as a value that is not null, the validator will validate that the attribute has a value that is the same as this property value. Defaults to null. See also $strict. public mixed $requiredValue = null

validators\RequiredValidator $message

$message public property The user-defined error message. It may contain the following placeholders which will be replaced accordingly by the validator: {attribute}: the label of the attribute being validated {value}: the value of the attribute being validated {requiredValue}: the value of $requiredValue public string $message = null

validators\RegularExpressionValidator validateValue()

validateValue() protected method Validates a value. A validator class can implement this method to support data validation out of the context of a data model. protected array|null validateValue ( $value )$value mixed The data value to be validated. return array|null The error message and the parameters to be inserted into the error message. Null should be returned if the data is valid. throws yii\base\NotSupportedException if the validator does not supporting data validation withou

validators\RegularExpressionValidator init()

init() public method Initializes the object. This method is invoked at the end of the constructor after the object is initialized with the given configuration. public void init ( )

validators\RegularExpressionValidator clientValidateAttribute()

clientValidateAttribute() public method Returns the JavaScript needed for performing client-side validation. You may override this method to return the JavaScript validation code if the validator can support client-side validation. The following JavaScript variables are predefined and can be used in the validation code: attribute: an object describing the the attribute being validated. value: the value being validated. messages: an array used to hold the validation error messages for the

validators\RegularExpressionValidator $pattern

$pattern public property The regular expression to be matched with public string $pattern = null

validators\RegularExpressionValidator $not

$not public property Whether to invert the validation logic. Defaults to false. If set to true, the regular expression defined via $pattern should NOT match the attribute value. public boolean $not = false