- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2018 02:43 AM
Hi,
Is possible to select particular day only in date.
Here er have to select only Monday .if i select apart form Monday tee form could be submit.
Regards,
Suri
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2018 02:54 AM
Hi Suri,
You would need to build a onChange client script that would check the date entered using the getDayOfWeek GlideDateTime function.
This gets the week day as a number (Monday = 1, Sunday = 7) which you can build logic to say if the day is not equal to 1 then clear the value and display an error message, advising to try again.
Example code below (untested)
var gdt = new GlideDateTime(g_form.getValue('fieldNameGoesHere'));
if(gdt.getDayOfWeek()!=1){
g_form.setValue('fieldNameGoesHere', '');
g_form.showFieldMsg('fieldNameGoesHere','You have entered an invalid date - please try again, selecting only a Monday','error');
}
Thanks
P.S. If this has been helpful or has answered your question please mark accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2018 02:54 AM
Hi Suri,
You would need to build a onChange client script that would check the date entered using the getDayOfWeek GlideDateTime function.
This gets the week day as a number (Monday = 1, Sunday = 7) which you can build logic to say if the day is not equal to 1 then clear the value and display an error message, advising to try again.
Example code below (untested)
var gdt = new GlideDateTime(g_form.getValue('fieldNameGoesHere'));
if(gdt.getDayOfWeek()!=1){
g_form.setValue('fieldNameGoesHere', '');
g_form.showFieldMsg('fieldNameGoesHere','You have entered an invalid date - please try again, selecting only a Monday','error');
}
Thanks
P.S. If this has been helpful or has answered your question please mark accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2018 07:58 AM
Graham, Can you please help me in this:
https://community.servicenow.com/community?id=community_question&sys_id=cb1391d5dbc163401cd8a345ca961959
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2018 10:00 PM
Thanks Graham,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2018 02:02 AM
Hello,
Here the complete code for reference,
we need to write Script Include:
Client Script OnChange:
If you are working in a global Application :
Use:
var ga = new GlideAjax('Monday');
If you are working in any scoped application
Use:
var ga = new GlideAjax('global.Monday');
Result:
Regards,
Suri