I think we need another property that can be configured with a piece of JS code representing a boolean value. Then we need modify https://github.com/yiisoft/yii2/blob/master/framework/widgets/ActiveField.php#L681 to insert this js code to toggle the validation code.