- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 04:42 AM
I have date field in the catalog form for which I am trying to get display value. I have tried
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 05:34 AM - edited 09-05-2023 05:45 AM
Hello @Divya V
Here's how you can modify your script to format a date in 'yyyy-mm-dd' format within a client-side script:
// Get the date field value as a string
var dateValue = g_form.getValue('workation_start_date');
// Create a JavaScript Date object from the date string
var jsDate = new Date(dateValue);
// Format the date to 'yyyy-mm-dd' format
var formattedDate = jsDate.getFullYear() + '-' +
('0' + (jsDate.getMonth() + 1)).slice(-2) + '-' +
('0' + jsDate.getDate()).slice(-2);
// Now 'formattedDate' contains the date in 'yyyy-mm-dd' format
alert(formattedDate); // Display the formatted date
In this script, we use JavaScript's Date object to manipulate the date value and format it in 'yyyy-mm-dd' format. The g_form.getValue('workation_start_date') method is used to get the value of the date field.
Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Thanks & Regards,
Kartik Magadum
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 05:33 AM
Hi Tushar,
There is an error message while client script is executing saying "GlideDate is not defined"
Thank you,
Divya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 06:40 AM
Hi @Divya V
Write on Submit, client script, calling the Script include using GlideAjax. You need to pass the Date field parameter to script include, have the comparison inside script include.
Then do the next process which will be easy for you to allow user to submit or not.
Please mark as helpful or correct, if it helps.