Skip to content

Commit 2f3de3b

Browse files
authored
Create script.js
1 parent 69c730d commit 2f3de3b

File tree

1 file changed

+20
-0
lines changed
  • Client-Side Components/Client Scripts/Dynamic script to make fields read only

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
It runs when the field value changes.
3+
If the new value equals '7', it retrieves all editable fields using g_form.getEditableFields().
4+
Then it loops through each field and sets it to read-only using g_form.setReadOnly().
5+
6+
*/
7+
8+
9+
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
10+
if (isLoading || newValue === '') {
11+
return;
12+
}
13+
14+
15+
if (newValue == '7') { // update condition as required
16+
var fields = g_form.getEditableFields();
17+
for (var i = 0; i < fields.length; i++) {
18+
g_form.setReadOnly(fields[i].getName(), true);
19+
}
20+

0 commit comments

Comments
 (0)