function onChange(control, oldValue, newValue, isLoading) { if (isLoading || newValue == '') { return; } //Type appropriate comment here, and begin script below var startDate = new Date(g_form.getValue('start_date')); //get the value of the start_date field using the g_form.getValue method var checkEnd = new Date(newValue); // create a new JS date from the desired end_date field (using newValue parameter) if (checkEnd <= startDate){ //Again - a simple JS Date object comparison alert('End date must be after start date'); g_form.setValue('end_date',''); } }
End date should be always greater than start date
Working Code Asked question March 7, 2025