- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-23-2022 11:05 PM
Hi Community,
Is there a way to make variable read only when I enter a data in single line text variable.
For example,
Single line text variable: Provide Code : Entered string length is 17 character.
when I add 17 character value in Provide code then Description variable should be editable.Right now description is a Readonly type
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-23-2022 11:29 PM
Hi SnowDev,
To make field "Provide Code" have max length of 17 characters, set Variable attribute to "max_length=17".
To make Description field editable when Provide Code is 17 characters, create a onChange client script.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.setReadOnly('description', true); // set to readonly as default
return;
}
if (newValue.length == 17) {
g_form.setReadOnly('description', false); // make description field editable only when provide_code is 17 characters
} else {
g_form.setReadOnly('description', true);
}
}
Execution result:
case 1: Provide code is less than 17 characters.
case 2: Provide code is 17 characters.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-23-2022 11:53 PM
Hi snowDEV,
I don't think is there any way that other field(in your case description ) will impact based on the the entering data. because on this scenario no script or UI policy will run.
You need to confirm with your customer. Without using any client script there is no OOB method to achieve this.
Mark it helpful if it helped you.
Thanks and regards
Anand

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-24-2022 01:22 AM
To check length of characters as they are being entered would require DOM manipulation.
It's not too recommended but adding onkeyup() function to input element would make it possible to dynamically count number of characters that were entered.
If this is just for Service Portal, a widget maybe clone to add this functionality.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-24-2022 12:21 AM
Thank you Anand