diff --git a/Client-Side Components/Client Scripts/Check all mandatory fields using mandatoryCheck()/README.md b/Client-Side Components/Client Scripts/Check all mandatory fields using mandatoryCheck()/README.md
index ea9a494c64..da8569c194 100644
--- a/Client-Side Components/Client Scripts/Check all mandatory fields using mandatoryCheck()/README.md
+++ b/Client-Side Components/Client Scripts/Check all mandatory fields using mandatoryCheck()/README.md
@@ -1,11 +1,17 @@
-**Client Script**
+# Mandatory Field Check on Form Change
-Client script which is showing how to use g_form.mandatoryCheck() function, which allows to easily detect if any of mandatory field is not filled on record.
+This client script demonstrates how to use `g_form.mandatoryCheck()` to validate whether all mandatory fields on a form are filled.
-**Example configuration**
+It is typically used in an **onChange** catalog client script to trigger validation when a specific field changes.
-
+If mandatory fields are missing, the script:
+- Displays an info message listing the missing fields. Note: the red message is the existing functionality that will give you an error message.
+- Visually highlights each missing field using a flashing effect to guide the user.
-**Example execution**
+This approach improves user experience by clearly indicating which fields require attention.
-
+**Example configuration**
+
+
+**Example execution**
+
diff --git a/Client-Side Components/Client Scripts/Check all mandatory fields using mandatoryCheck()/script.js b/Client-Side Components/Client Scripts/Check all mandatory fields using mandatoryCheck()/script.js
index 197edcfb5e..d83106348e 100644
--- a/Client-Side Components/Client Scripts/Check all mandatory fields using mandatoryCheck()/script.js
+++ b/Client-Side Components/Client Scripts/Check all mandatory fields using mandatoryCheck()/script.js
@@ -1,19 +1,17 @@
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
- if (isLoading || newValue === '') {
- return;
- }
-
- //Client script, which shows how to use mandatoryCheck() function
- //mandatoryCheck() allows validating if all mandatory fields are filled
- //If all mandatory fields are filled it return true, otherwise it returns false
+ if (isLoading || newValue === '') {
+ return;
+ }
- //Check if all mandatory fields are filled on record
+ // Check if all mandatory fields are filled
if (!g_form.mandatoryCheck()) {
-
- //Example action when not all mandatory fields are filled - display message and remove state field
+ //if not get all missing fields
var missing = g_form.getMissingFields();
- g_form.addInfoMessage("State field removed, because not all mandatory fields are filled: " + missing);
- g_form.setDisplay('state', false);
+ //Info message displaying the fields that are missing
+ g_form.addInfoMessage("Please complete the following mandatory fields: " + missing.join(", "));
+ //go through missing fields and flash them
+ missing.forEach(function (fieldName) {
+ g_form.flash(fieldName, "#FFFACD",0); // Flash to draw attention
+ });
}
-
}