phone number should accept only 10 digits
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2018 05:13 AM
i want the phone number in a form to accept only 10 digits
- Labels:
-
User Experience and Design

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2018 11:54 AM
Hi, please see this link which includes an example of an onChange script that will monitor that field: https://community.servicenow.com/community?id=community_question&sys_id=4a144fe5dbd8dbc01dcaf3231f96...
You'd have to tweak it so something like:
if(newValue.length != 10){
alert('Invalid value. Please enter a 10 digit phone number.');
}
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2018 12:05 PM
I would also do the validation on the field to make sure they are entering digits
you can use regular expression for that something like
/^\d+$/.test(val)