- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-21-2022 11:24 AM
Hi,
I need to restrict the first name and last name fields more than 15 letters
Can you help me on script?
Thanks in Advance!!
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-21-2022 01:28 PM
Can you please try
g_form.addErrorMessage Instead of showErrorBox.
***Mark Correct or Helpful if it helps.***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-21-2022 11:38 AM
Hi christopherperry,
Thanks for the response
It is not string type field it is a variable in catalog item for onboard form
I need to populate error if they enter more than 15 characters
Can you please help me on this script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-21-2022 11:40 AM
Hi Hemanth,
Please try,
function onSubmit() {
if(g_form.getValue('field_name').length > 15){
g_form.showFieldMsg('Enter less than 15 characters ', 'error', true);
return false;
}
}
Mark Correct and 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
ā09-21-2022 11:55 AM
Hi Yousaf,
Thanks for the script,
Is it possible to calculate first name field and last name field and show the error if it is more than 15 characters?
Thanks in Advance!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-21-2022 11:59 AM
hemanth you mean the total of both fields?
first name + last name should not be greater than 15?
***Mark Correct or Helpful if it helps.***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-21-2022 12:04 PM
Hi Yousaf,
Yes first name + last name should not be greater than 15?