Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 08:53 PM
I have a requirement that the value in #CPU should be more than 1 and less than 17
I achieved that using regex but it is still showing below bug. How to fix this?
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 11:08 PM
something like this should work
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
g_form.hideFieldMsg('variableName');
newValue = parseInt(newValue);
var regex = /^(?:[2-9]|1[0-6])$/;
if (!regex.test(newValue)) {
g_form.showFieldMsg('variableName', 'Please enter a number between 2 and 16.', 'error');
g_form.clearValue('variableName');
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
10 REPLIES 10
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 01:51 AM
Thank you Ankur