How to set the limit in a integer field value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 06:59 AM
Hi All,
I have a question how to put the limit on any integer field. Like in a field we only put the integer value but I also want to specify that field like user can only enter min 5 digit or max 7 digit numeric value. I have already written the On-change catalog client script for only entering the integer value but also want to limit the number of digits.
Request you to please help or guide.
Thanks/Utkarsh
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 07:08 AM
Hey Utkash,
Try this onChange Client Script on your Field (Select the field 1st):
if(newValue.length > 7){
alert('yes');
}
else{
alert('no');
}
}
Modify the script according to your need. If it works then please mark my answer Correct and Helpful.
Thanks and Regards:
Utpal Dutta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 11:29 PM
It worked on me, thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 07:08 AM
Hi,
You can use length to determine the number of digits.
Ex:
var len= g_form.getValue('<<fieldname>>').length; //replace with variable name
if(len<5)
{
alert('Number should be at least 5 digits in length');
g_form.setValue('<<fieldname>>',''); //replace with variable name
}
else if(len >7)
{
alert('Number should not exceed 7 digits in length');
g_form.setValue('<<fieldname>>',''); //replace with variable name
}
If I have answered your question, please mark my response as correct and/or helpful.
Thanks,
Suseela P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 07:11 AM
Go to below link:
If it works then please mark my answer Correct and Helpful
Thanks and Regards:
Thousif