src/models/Record.php
protected function buildRuleWhenClient($type, $not = false)
    {
        $not = Json::encode($not);
        $types = Json::encode((array) $type);

        return new JsExpression("
            function (attribute, value) {
                var type = $(attribute.input).closest('.record-item').find('[data-attribute=type]');
                if (!type) return true;
                var types = $types;
                return $not !== (types.indexOf(type.val()) > -1);
            }
        ");
    }
protected function buildRuleWhenClient($type, $not = false)
    {
        $not = Json::encode($not);
        $types = Json::encode((array) $type);

        return new JsExpression("
            function (attribute, value) {
                var type = $(attribute.input).closest('.record-item').find('[data-attribute=type]');
                if (!type) return true;
                var types = $types;
                return $not !== (types.indexOf(type.val()) > -1);
            }
        ");
    }
protected function buildRuleWhenClient ( $ type , $ not = false ) { $ not = Json :: encode ( $ not ) ; $ types = Json :: encode ( ( array ) $ type ) ; return new JsExpression ( "
            function (attribute, value) {
                var type = $(attribute.input).closest('.record-item').find('[data-attribute=type]');
                if (!type) return true;
                var types = $types;
                return $not !== (types.indexOf(type.val()) > -1);
            }
        " ) ; }
Builds the JS expression for Yii `whenClient` validation in order to apply validation to only a certain
list of DNS record types.

@param array|string $type types, that are must be validated with the rule
@param bool $not inverts $type
@return JsExpression
Builds the JS expression for Yii whenClient validation in order to apply validation to only a certain list of DNS record types .