- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 02:48 AM
I'm trying to set all fields read only when my state on incident form changes to canceled!!
Here's the code i've written and i'm currently using utah version but this code isn't working. Is there any possibility that getEditablefields() function doesn't work anymore?
If there's any other solution, do let me acknowledge.
That'll will be a great help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 03:14 AM - edited ‎10-16-2023 03:21 AM
Everything you have done is correct except for loop, you didn't set an original value to i.
Please replace: for (var i;i<field.length;i++) with for (var i=0;i<field.length;i++)
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue == '8'){
var field = g_form.getEditableFields();
for (var i=0;i<field.length;i++){
g_form.setReadOnly(field[i],true);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2024 11:13 PM
When I used this script my instance getting slow and went in hung state
can you explain why this happnes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 03:22 AM
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue == '8'){
var field = g_form.getEditableFields();
for (var i=0;i<field.length;i++){
g_form.setReadOnly(field[i],true);
}
}
}
