From d08d580643b3d167554d5bc892c062ceccf3e66b Mon Sep 17 00:00:00 2001 From: Tushar Balar Date: Tue, 20 Dec 2022 22:20:04 +0530 Subject: [PATCH 1/3] fix(CODE): ADDON-58867 Fixed value of drop-down field with cancelling button --- src/main/webapp/components/BaseFormView.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/components/BaseFormView.jsx b/src/main/webapp/components/BaseFormView.jsx index d959564c..9601ceed 100644 --- a/src/main/webapp/components/BaseFormView.jsx +++ b/src/main/webapp/components/BaseFormView.jsx @@ -714,8 +714,8 @@ class BaseFormView extends PureComponent { }); } - // This is the custom logic to handle the dropdown's reset value, and we are setting null value - const target_value = targetValue === 'RESET_DROPDOWN_VALUE' ? null : targetValue; + // This is the custom logic to handle the dropdown's reset value, and we are setting empty string. + const target_value = targetValue === 'RESET_DROPDOWN_VALUE' ? '' : targetValue; changes[field] = { value: { $set: target_value } }; const newFields = update(this.state, { data: changes }); From 0e07bdfd883e0e7418cadbfa9bab57a8087bbe70 Mon Sep 17 00:00:00 2001 From: Tushar Balar Date: Wed, 21 Dec 2022 10:46:33 +0530 Subject: [PATCH 2/3] fix(CODE): ADDON-58867 Added comments --- src/main/webapp/components/BaseFormView.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/components/BaseFormView.jsx b/src/main/webapp/components/BaseFormView.jsx index 9601ceed..9d233597 100644 --- a/src/main/webapp/components/BaseFormView.jsx +++ b/src/main/webapp/components/BaseFormView.jsx @@ -714,7 +714,11 @@ class BaseFormView extends PureComponent { }); } - // This is the custom logic to handle the dropdown's reset value, and we are setting empty string. + /* + * Custom logic to handle the dropdown's reset value by clicking X button. + * DO NOT CHANGE: string to null (or anything else) + * We are not sending null value in the API, this validation is inside the saveData(). + * */ const target_value = targetValue === 'RESET_DROPDOWN_VALUE' ? '' : targetValue; changes[field] = { value: { $set: target_value } }; From b6936ce5ed655e537a486b143651eed0599d87a5 Mon Sep 17 00:00:00 2001 From: Tushar Balar Date: Wed, 21 Dec 2022 11:29:58 +0530 Subject: [PATCH 3/3] fix(CODE): ADDON-58867 Added discriptive comments --- src/main/webapp/components/BaseFormView.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/components/BaseFormView.jsx b/src/main/webapp/components/BaseFormView.jsx index 9d233597..fe9309be 100644 --- a/src/main/webapp/components/BaseFormView.jsx +++ b/src/main/webapp/components/BaseFormView.jsx @@ -715,10 +715,11 @@ class BaseFormView extends PureComponent { } /* - * Custom logic to handle the dropdown's reset value by clicking X button. - * DO NOT CHANGE: string to null (or anything else) - * We are not sending null value in the API, this validation is inside the saveData(). - * */ + * Custom logic to handle the dropdown's reset value by clicking "X" button. + * DO NOT CHANGE: value of targetValue to null or any other value. Keep it as blank string only. + * Reason: We are sending a blank string value in the API, and this validation is inside the saveData(). + */ + const target_value = targetValue === 'RESET_DROPDOWN_VALUE' ? '' : targetValue; changes[field] = { value: { $set: target_value } };