Catalog Client Script help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 09:31 AM
Hello Team
I have this simple catalog client script. I don't see any problem with this but I'm not sure why it's not working. Thanks for your help.
Type: Onchange
variable name: end_date

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 09:52 AM
Can you try this?
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Start date should not allow past date
var courseStartDate = new Date(g_form.getValue('start_date')); //get start date selected by the user
var courseEndDate = new Date(g_form.getValue('end_date')); //get end date selected by the user.
if (courseEndDate < courseStartDate) {
g_form.addErrorMessage('The End Date should be after the Start Date');
g_form.clearValue('end_date');
}
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 09:57 AM
If doesnt wrok, try glideajax. Use Case 4 in below thread should help you.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 10:02 AM - edited 03-18-2024 10:02 AM
Hi @huyjor ,
Try to log the info and check if your get any response
if (courseEndDate < courseStartDate ) {
g_form.addErrorMessage('The End Date should be after the Start Date');
g_form.clearValue('courseStartDate');
}
You don't have to use .value(), seems like it's a Gpt code ...
I hope this helps...
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 11:24 AM
Nope, It's not working. It's weird that my code is working on the platform client script but not on the catalog client script. It makes no sense.