- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 07:02 AM
I am very new to ServiceNow. We are trying to limit the ability to enter dates in a field to the datepicker only. I have referenced the doc -
and confirmed that the property is configured to true (we are on Helsinki). However dates still can be typed into the datepicker. I'm sure there is something easy I need to do to the field or form to enable this, but I am unable to find anything anywhere. Any help would be appreciated.
Thanks,
Keith
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 08:46 AM
Hi Keith,
You can easily achieve this via an onLoad Client Script. See below, just replace 'field_name' with the actual name of your date or date/time field.
- function onLoad() {
- // Sets the field's background to a gray, making is appear read-only.
- g_form.getControl('field_name').className='disabled';
- // Sets the field read-only
- g_form.getControl('field_name').readOnly=true;
- }
Please mark this response as correct and helpful via your post link (Configuring the datepicker ) to help others with the same question.
Thanks,
Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2017 09:53 AM
Hi Keith, apologies - just seen this. I'll take a look and check for you.
Cheers,
Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2017 10:03 AM
No worries and it turns out there is customization within our instance which is causing this to not work correctly. It works fine when I apply it to other date fields. We are looking into the conflicting script to determine if we can modify around it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2017 05:58 AM
Great, I'm glad its resolved.
Cheers, Robbie.