on load client script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2025 03:18 AM
Set all the fields ReadOnly based on selection of particular choice in a field (state = cancelled).
on load
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2025 08:41 AM
You can use an onChange client script or UI Policy. Put this in the script section:
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2025 08:49 AM
@Maidhili_G Please try the following script.
function onLoad() {
var stateValue = g_form.getValue('state');
// Ensure this matches the actual value of the "Cancelled" choice in your state field
if (stateValue === 'cancelled') {
var fields = g_form.getEditableFields();
for (var i = 0; i < fields.length; i++) {
g_form.setReadOnly(fields[i], true);
}
// Optional: keep the 'state' field editable to allow reverting
// g_form.setReadOnly('state', false);
}
}