Need a dependent required validator

Hi there

I need a built-in client validation for text-box required validator if on of my radio buttons selected. Both text-box and radio are come from model.

For now I have a custom validator that check the input if form submitted. Actually its only a server side validator.

Thanks in advance.

Docs say: "If you also need to support client-side conditional validation, you should configure the whenClient property which takes a string representing a JavaScript function whose return value determines whether to apply the rule or not."

http://www.yiiframework.com/doc-2.0/guide-input-validation.html#conditional-validation

See also docs for whenClient property: http://www.yiiframework.com/doc-2.0/yii-validators-validator.html#$whenClient-detail