validators\Validator $whenClient

$whenClient public property

A JavaScript function name whose return value determines whether this validator should be applied on the client-side. The signature of the function should be function (attribute, value), where attribute is an object describing the attribute being validated (see clientValidateAttribute()) and value the current value of the attribute.

This property is mainly provided to support conditional validation on the client-side. If this property is not set, this validator will be always applied on the client-side.

The following example will enable the validator only when the country currently selected is USA:

function (attribute, value) {
    return $('#country').val() === 'USA';
}

See also $when.

public string $whenClient = null
doc_Yii
2016-10-30 17:14:16
Comments
Leave a Comment

Please login to continue.