The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Multi line variable to set field length of 4000 characters for record producer in ITSM

Are Kaveri
Tera Contributor

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

4 REPLIES 4

Murthy Ch
Giga Sage

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

 

Thanks,
Murthy

@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

 

Community Alums
Not applicable

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

Saurav11
Kilo Patron
Kilo Patron

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.