Dear Customer,
Greetings from Syncfusion Support.
We have prepared a sample to validate the autocomplete control which can be viewed from the following link.
popupOpen: function (args) {
if (args.type === 'Editor') {
// Create required custom elements in initial time
if (!args.element.querySelector('.custom-field-row')) {
var row = new ej.base.createElement('div', { className: 'custom-field-row' });
var formElement = args.element.querySelector('.e-schedule-form');
formElement.firstChild.insertBefore(row, args.element.querySelector('.e-title-location-row'));
var container = new ej.base.createElement('div', { className: 'custom-field-container' });
var inputEle = new ej.base.createElement('input', {
className: 'e-field'
});
inputEle.setAttribute('name', 'AttendeesArray');
container.appendChild(inputEle);
row.appendChild(container);
var autoObj = new ej.dropdowns.AutoComplete({
dataSource: members,
fields: { value: 'text' },
floatLabelType: 'Always', placeholder: 'Team Members',
filtering: function () {
if (!ej.base.isNullOrUndefined(document.getElementById("AttendeesArray-info"))) {
document.getElementById("AttendeesArray-info").style.display = "none";
}
}
});
autoObj.appendTo(inputEle);
var validator = formElement.ej2_instances[0];
validator.addRules('AttendeesArray', { required: true });
}
args.element.ej2_instances[0].open = function () {
autoObj.focusIn();
}
}
}
For validating default fields kindly check the online sample demo
here and for more details about validation please refer following UG link.
Regards,
Nevitha