Multi line variable to set field length of 4000 characters for record producer in ITSM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2022 06:48 AM
I have a requirement as below
field_1 =multi line text
field_2 = multi line text
need to restrict length of the above variables to 4000 characters. The user should not be able to enter more than 4000 characters.
i have tried setting the variable attribute as max_length=4000 . But it was not working for multiline text variables. Is there any other way to set the variable length?
if there is any alternate solution please share with me.
Thank you for advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2022 06:57 AM
Hi @Are Kaveri
Then you can use onSubmit CS and restrict the user to submit the catalog.
Sample code below:
function onSubmit()
{
if(g_form.getValue("variable1").length>4000 || g_form.getValue("variable2").length>4000)
return false;
else
return true;
}
Hope it helps
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2022 07:09 AM
@Murthy Ch since the validation takes place while submission..
the user need to fill whole form and then while submission this happens. But here there expectation is not to enter more than 4000 characters, As soon as when user enters more than 4000 characters he should get some prompt and should not allow more than 4000 characters.
we will be having same feature for single line text field where we give max_length

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2022 07:02 AM
Hi @Are Kaveri ,
By default, multi-line text fields have a 4,000-character limit. To help users see how many characters remain before they reach the limit, you can enable the glide.ui.textarea.character_counter property.
Please refer to documentation for more details here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2022 07:08 AM - edited ‎10-17-2022 07:10 AM
Hello,
Write a On submit Client script with the below code. So user is not bale to submit the item if there are more than 4000 character in the multi line variable:-
function onSubmit() {
var len=g_form.getValue('replacevariablename1');
var len1=g_form.getValue('replacevariablename2');
if(len.length>4000 || len1.length>4000)
{
alert("You cannot exceed 4000 characters");
return false;
}
else
{
return true;
}
}
Please mark my answer as correct based on Impact.