- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 05:04 AM
Hi Guys,
I have two date/time variables with names campaign_start_date and campaign_end_date on the catalog item view.
I need to check if the campaign_end_date is less than campaign_start_date, I need to clear campaign_end_date value and show a field message.
is there a way to do that using the Catalog UI policy? if yes, please help me out using the catalog UI Policy because it is my first preference.
if not, could you please provide me with the catalog client script code?
thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 07:49 AM
I am using Catalog UI Policy.
Condition: compaign_start_date is more than 0 Hours after compaign_end_date
Script: g_form.clearValue('compaign_end_date');
g_form.showFieldMsg('compaign_end_date', 'End Date must be at or after start date.', 'error', true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 07:49 AM
I am using Catalog UI Policy.
Condition: compaign_start_date is more than 0 Hours after compaign_end_date
Script: g_form.clearValue('compaign_end_date');
g_form.showFieldMsg('compaign_end_date', 'End Date must be at or after start date.', 'error', true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 06:42 AM
Hi,
You can achieve this by using catalog client script(onChange).
var a = g_form.getValue("end_date");
var b = g_form.getValue("start_date");
if(a<b){
g_form.addErrorMessage("fd");
g_form.clearValue("end_date");
}else{
g_form.clearMessages();
}
Mark as correct if it helps
Regards Mythily