To restrict negative values in amount field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 12:50 AM
Hi All,
I have requirement to restrict user to enter negative value in amount field. I wrote on submit script which is working fine when I enter two digits or three digits like 78 or 651 etc, But when I enter more than three digits, entered value comes with comma(,) and it is not working when comma is there in value (4,567).
In the attachment script is there , Please suggest solutions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 01:51 AM
hi @Tarasingh26 ,
Can to pass attribute for the integer field's dictionary as format=none, so comma will not be shown.
Please mark the reply as helpful and solution
Thanks
Akash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 01:51 AM
Would that work before the if statement?
var amt1=parseInt(amt1.replace(',','');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 01:58 AM
Hi,
Check this article, this has all the validations using regex for Integer fields
How to allow integers in the string field for more... - ServiceNow Community