Limit the Number of Characters in a Variable

vcaracci75
Tera Expert

When you create a variable for a requested Item, is there a way to set a limit to  the number of characters that can be entered into the field?

1 ACCEPTED SOLUTION

Shishir Srivast
Mega Sage

You may find many solution on the community for this, an example you can use script like below with onChange() client script.

var str = newValue; // var str = g_form.getValue('variable_name')
var len = str.length;
if(len> 10 && len< 5)
{
g_form.setValue('variable_name','');
alert('Please enter atleast 5 and maximum of 10');
}

 

Or you can Click on configure variable. Goto default Value tab-->in variable attribute field add below.

max_length=40 // OR set the limit value which you want to set.

View solution in original post

5 REPLIES 5

SanjivMeher
Kilo Patron
Kilo Patron

You will need to write a onChange client script on that field to limit the characters.


Please mark this response as correct or helpful if it assisted you with your question.

Shishir Srivast
Mega Sage

You may find many solution on the community for this, an example you can use script like below with onChange() client script.

var str = newValue; // var str = g_form.getValue('variable_name')
var len = str.length;
if(len> 10 && len< 5)
{
g_form.setValue('variable_name','');
alert('Please enter atleast 5 and maximum of 10');
}

 

Or you can Click on configure variable. Goto default Value tab-->in variable attribute field add below.

max_length=40 // OR set the limit value which you want to set.

Thank you!

the max length attribute on a record producer worked perfectly. thank you

simple