Hi everyone,
I have a constraint that a maximum of 10 days are allowed for employees to travel for work. I have 2 date/time fields that are compared to come up with total days.
I am using a formula to calculate this total and calling it Consecutive Days. It is a hidden & read only field. I am using a CSS class to hide it.
When there is a date in both departure AND return fields, then the hidden field is shown. I am using jQuery to assign a max value of 10 to the Consecutive Days field.
//set max concesutive days
new function(){
$(".consecDays input").attr("max", '10');
};
//make visible consecutive days when departure & return dates populated
$('.consecDays').change(function(){
if (($('.depDateTimeClass input').val().length !== 0) && ($('.retDateTimeClass input').val().length !== 0)){
$('.consecDays').removeClass('hide');
} else {
$('.consecDays').addClass('hide');
}
});
My issue is that I see a number over that is greater than 10 with no validation error message.
Once the Consecutive Days field is visible, if I click on it and then out, the validation error message appears.
I have tried duplicating the click events, but had no luck. I have tried .trigger('updatevalidation') from this post.
I know that I can perform the validation in jQuery and display the error validation, but I am at a loss of why this way doesn't work. I am probably missing something. What is it?
Thanks for the help in advance :)