Hello,
I have DateTimePicker component in Schedule dialog where I need some validation.
After popupOpen event i have setup DateTimePicker component and add validation.
init of DateTimePicker:
let endElement = args.element.querySelector('#EndTime');
if (!endElement.classList.contains('e-datetimepicker')) {
_endTimeDatePicker = new ej.calendars.DateTimePicker({
value: new Date(endElement.value) || new Date(),
format: 'yyyy-MM-dd HH:mm',
// readonly: true
}, endElement);
}
adding validation:
var formElement = args.element.querySelector('.e-schedule-form');
_validator = ((formElement).ej2_instances[0]);
_validator.addRules('Note', { required: true });
_validator.addRules('StartTime', { minDate: [customFn, 'Enter valid date'] });
_validator.customPlacement = function (inputElement, errorElement) {
console.log('input', inputElement);
inputElement.parentNode.parentNode.appendChild(errorElement);
};
After changing anything in StartTime, customFn is not triggered.
Do yo have any advice?