diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md
index 744c256..7ab275d 100644
--- a/framework/CHANGELOG.md
+++ b/framework/CHANGELOG.md
@@ -12,6 +12,7 @@ Yii Framework 2 Change Log
 - Bug #5657: `yii\caching\ApcCache::mset()` and `madd()` may cause warning in some APC setup (LAV45)
 - Bug #5665: The `currentPage` meta data in the RESTful result should be 1-based, similar to that in HTTP headers (qiangxue)
 - Bug #5682: The `asset` command would incorrectly combine CSS files when `UrlManager::linkAssets` is true (dmvslv)
+- Bug #5702: Parenthesis should be automatically added to `Validator::whenClient` to avoid js error (mdmunir, qiangxue)
 - Bug: Gii console command help information does not contain global options (qiangxue)
 - Enh #3760: Gii model generator now imports classes when necessary instead of using fully qualified class names (umneeq, samdark)
 - Enh #5223: Query builder now supports selecting sub-queries as columns (qiangxue)
diff --git a/framework/widgets/ActiveField.php b/framework/widgets/ActiveField.php
index 81afb27..a076e28 100644
--- a/framework/widgets/ActiveField.php
+++ b/framework/widgets/ActiveField.php
@@ -710,7 +710,7 @@ class ActiveField extends Component
                 $js = $validator->clientValidateAttribute($this->model, $attribute, $this->form->getView());
                 if ($validator->enableClientValidation && $js != '') {
                     if ($validator->whenClient !== null) {
-                        $js = "if ({$validator->whenClient}(attribute, value)) { $js }";
+                        $js = "if (({$validator->whenClient})(attribute, value)) { $js }";
                     }
                     $validators[] = $js;
                 }