- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2020 09:18 AM
Hello,
I have 3 date fields on my record producer.
1) Start date - 'pay_period_start'
2) End date - 'pay_period_end'
2) Date - 'date'
I need to compare the 'date' with the Start Date & End date. This will decide what happens on the form. Here is my on change client script so far. it is not working:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var dateValue = g_form.getValue('date');
var start = g_form.getValue('pay_period_start');
var end = g_form.getValue('pay_period_end');
if (dateValue < start || dateValue > end) {
g_form.showFieldMsg('date', ':Please provide an explanation.', 'error');
g_form.setVisible('past_date_hours_explanation', true);
g_form.setMandatory('past_date_hours_explanation', true);
}
else {
g_form.hideFieldMsg('date');
g_form.setMandatory('past_date_hours_explanation', false);
g_form.setVisible('past_date_hours_explanation', false);
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2020 10:14 AM
use glide ajax here, and in client callable script include compare it, based on that return true or false , you will get more flexibility in date comparison if you will use script include + glideajax.
sample code mentioned in below thread.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2020 09:54 AM
all 3 variables are date/time type variable ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2020 10:05 AM
They are not date/time variables, they are only date variables

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2020 10:14 AM
use glide ajax here, and in client callable script include compare it, based on that return true or false , you will get more flexibility in date comparison if you will use script include + glideajax.
sample code mentioned in below thread.