
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2019 04:12 AM
hi experts,
I set "Date" max length is 4, but in form layout it can input 15 ,why?
Solved! Go to Solution.
- Labels:
-
Instance Configuration

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2019 04:55 AM
That's not possible. You can't restrict the user to add only 4 numbers. You could use the workaround Anurag and I mentioned, giving an error, maybe even do g_form.clearValue('u_date') to empty the field.
If really restricting the input, you can look at DOM manipulation. Though that's BAD PRACTICE. So not adviced.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2019 05:31 AM
That is not possible oob, and to be honest, this is not the type of ask for which I would suggest any type of DOM Manipulation.
Also with the error message you can clear the field value using g_form.clearValue('<field name>')
Please mark my answer correct/helpful if this solves you or helps you in any way.
-Anurag
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2019 04:19 AM
Hello ,
If you set its value to 4 then it will not allow,when you are trying to SAVE the form.
Thank You,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2019 04:30 AM
I don't think so, you did shook my confidence and then i tested it in my PDI. It doesn't work like that. 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2019 04:36 AM
No that's not correct. You can test this yourself in a PDI for example.
Kind regards,
Mark
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2019 04:36 AM
use below script to make some restriction here.
you can use the below code in onChange() client script on your field to validate it.
sample code:
if(g_form.getValue('u_date')> 4){
alert(' its not allow');
}
else{
alert('allow');
}