Hi syncfusion team,
my codebase is nearly the same (at least very similiar) to the following example for form validation: https://ej2.syncfusion.com/react/documentation/schedule/editor-template/#apply-validations-on-editor-template-fields
Unfortunately the 'ej2_instances' property is 'undefined' and therefore throws an error:
let formElement = args.element.querySelector('.e-schedule-form');
let validator = formElement.ej2_instances[0];
The seletion works and also the form Element can be accessed. The only problem seems to be that the 'ej2_instances' property doesnt exists.
Thanks in Advance,
Gabriel
Hi,
my code regarding the popupOpen eventlistener inside the ScheduleComponent. I have only copied the relevant part, the rest is unimportant:
The output of the logging can you see in the added files.
|
<ScheduleComponent
width="100%"
height="650px"
selectedDate={new Date(2021, 1, 15)}
ref={(schedule) => (this.scheduleObj = schedule)}
eventSettings={{ dataSource: this.data }}
editorTemplate={this.editorTemplate.bind(this)}
actionBegin={this.onActionBegin.bind(this)}
showQuickInfo={false}
eventRendered={this.onEventRendered.bind(this)}
popupOpen={ function(args) {
if (args.type === 'Editor') {
console.log('Args: ');
console.log(args);
let formObj = args.element.querySelector('.e-schedule-form').ej2_instances[0];
console.log(formObj);
}
}} > |
Hi,
your sample is basically the same as my code. It doesnt matter whether i access the index 0 or not. The array is still undefined.
Regards,
Gabriel
I was trying to replicate the issue but did not succeed. After that i updated my version from 19.3.55 to 19.4.40 in case that had something to do with the issue, but it did not.
I then tried to implement the validation using the 'FormValidator' and it works now.
But it was weird, because the 'ej2_instances' property was accessable in every element (at least in the parent elemnts) except in the 'e-schedule-form'.
I have changed the sample to fit my code (only the part that really was influencing the scheduler) if you want to have a look, although it just works fine in there.
Nevertheless thanks,
Gabriel
Hi Gabriel,
Thanks for the update.
Could you please confirm our latest version has resolved your problem?
Regards,
Vengatesh