From 2f3de3b7afe2ccbbac54a27487a28471c7fdb987 Mon Sep 17 00:00:00 2001 From: bharakm Date: Wed, 22 Oct 2025 09:22:26 -0500 Subject: [PATCH 1/2] Create script.js --- .../script.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Client-Side Components/Client Scripts/Dynamic script to make fields read only/script.js diff --git a/Client-Side Components/Client Scripts/Dynamic script to make fields read only/script.js b/Client-Side Components/Client Scripts/Dynamic script to make fields read only/script.js new file mode 100644 index 0000000000..a685a9f35c --- /dev/null +++ b/Client-Side Components/Client Scripts/Dynamic script to make fields read only/script.js @@ -0,0 +1,20 @@ +/* +It runs when the field value changes. +If the new value equals '7', it retrieves all editable fields using g_form.getEditableFields(). +Then it loops through each field and sets it to read-only using g_form.setReadOnly(). + +*/ + + +function onChange(control, oldValue, newValue, isLoading, isTemplate) { + if (isLoading || newValue === '') { + return; + } + + + if (newValue == '7') { // update condition as required + var fields = g_form.getEditableFields(); + for (var i = 0; i < fields.length; i++) { + g_form.setReadOnly(fields[i].getName(), true); + } + From 97e1af8b4efe59917b962c6685e261e4650a339c Mon Sep 17 00:00:00 2001 From: bharakm Date: Wed, 22 Oct 2025 09:26:00 -0500 Subject: [PATCH 2/2] Create reame.md --- .../Dynamic script to make fields read only/reame.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Client-Side Components/Client Scripts/Dynamic script to make fields read only/reame.md diff --git a/Client-Side Components/Client Scripts/Dynamic script to make fields read only/reame.md b/Client-Side Components/Client Scripts/Dynamic script to make fields read only/reame.md new file mode 100644 index 0000000000..ada42d5c30 --- /dev/null +++ b/Client-Side Components/Client Scripts/Dynamic script to make fields read only/reame.md @@ -0,0 +1,5 @@ +Dynamic script to make fields read only + +It runs when the field value changes.On change client script +If the new value equals '7', it retrieves all editable fields using g_form.getEditableFields(). +Then it loops through each field and sets it to read-only using g_form.setReadOnly().