function onChange(control, oldValue, newValue, isLoading) { if (isLoading || newValue == '') { return; } g_form.hideErrorBox('num'); var pattern =/^\d+$/; // regex pattern if(!pattern.test(newValue)){ g_form.showErrorBox('num', getMessage('Please enter Positive number only'));//show error messege g_form.setValue('num', ''); } }
Regex to allow only Positive Number Client Script ServiceNow
Working Code Asked question August 8, 2023