- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022 04:31 PM
Hi All,
I have a requirement for which I have to create a variable and apply below validation.
For ID variable, the user has able to add upto 5 entries upto 255 characters.
I am unable to apply validation. Could anyone suggest me how to achieve above validation for a variable.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022 05:44 PM
Try something like this
Change length values and variables names as needed.
function onSubmit()
{
var studentID = g_form.getValue('u_email');
var arrayID = studentID.split(',');
if (studentID.length >= 254 || arrayID.length >= 4) {
g_form.addErrorMessage('Please ensure the Student ID is 255 characters long');
return false;
}
}
***Mark Correct or Helpful if it helps.***

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022 04:35 PM
Hi,
Are you talking about field on the form or variable in catalog item ?
OOB field length for Question is 255. You need to do below.
1. Open the required variable form.
2. Right click the Question field & then Configure Dictionary
3. Then update Max length field.
Mark Correct or Helpful if it helps.
***Mark Correct or Helpful if it helps.***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022 04:39 PM
On a record producer I have created a variable called student id and I need to apply validation for the student id variable. If user adds more than 5 entries with comma separated values he need to get alert and the whole length should not exceed 255 characters.
The max length, i have added in attribute. But I am not understanding understanding how to add validation.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2022 05:44 PM
Try something like this
Change length values and variables names as needed.
function onSubmit()
{
var studentID = g_form.getValue('u_email');
var arrayID = studentID.split(',');
if (studentID.length >= 254 || arrayID.length >= 4) {
g_form.addErrorMessage('Please ensure the Student ID is 255 characters long');
return false;
}
}
***Mark Correct or Helpful if it helps.***