Scheduler with form save Error

I have an app with Scheduler 5.2.1 where I have a Layout with 3 cells.
On a cell, there is a schedule with dataprocessor.
On b cell, there is a form with another dataprocessor.
On c cell there is a list.

The database is MySQL and I use the same table for the schedule and the form. In the form I have more detailed data from the events in the schedule cell.

The schedule and list works fine. I can update and save and retrieve data from the database.

When I try to save the form, with the scheduler

`  <script src="https://cdn.dhtmlx.com/scheduler/edge/dhtmlxscheduler.js"></script>
   <link href="https://cdn.dhtmlx.com/scheduler/edge/dhtmlxscheduler_material.css" 
        rel="stylesheet" type="text/css" charset="utf-8"> `  

When I do the .save method on form, it produces an error.

“Uncaught TypeError: Cannot read property ‘query’ of undefined
at window.dataProcessor._sendData (dhtmlxscheduler.js:1491)
at window.dataProcessor.sendAllData (dhtmlxscheduler.js:1558)
at window.dataProcessor.sendData (dhtmlxscheduler.js:1412)
at dhtmlXForm.save (dhtmlx.js:9)
at dhtmlXForm. (MyReportPage.js:142)
at dhtmlXForm.a.callEvent (dhtmlxform.js:9)
at dhtmlXForm. (dhtmlx.js:9)
at dhtmlXForm.a.callEvent (dhtmlxform.js:9)
at dhtmlXForm.x..callEvent (dhtmlx.js:9)
at HTMLDivElement.C.callEvent (dhtmlx.js:9)”

When I remove the scheduler.js and use normal dataprocessor.js the form works perfectly.

Is there a way around this error?
Follows the javascript below.
`function doScheduler() {
myReportLayout = new dhtmlXLayoutObject({
parent: “layoutObj”,
pattern: “3L”,
cells: [{id: “a”, text: “Calendario:”, height: 650}],
cells: [{id: “b”, text: “Detalhes:”, height: 550}],
cells: [{id: “c”, text: “Log de Atividades:”, height: 300}],
});
if (typeof(window.scheduler) == “undefined”) {
if (window.dhtmlx != null && window.dhtmlx.message != null) {
window.setTimeout(function(){
dhtmlx.message({type: “error”, text: “dhtmlxScheduler required for this demo”});
},1);
} else {
alert(“dhtmlxScheduler required for this demo”);
}
} else {
scheduler = myReportLayout.cells(“a”).attachScheduler();
scheduler.config.multi_day = true;
scheduler.config.event_duration = 30;
scheduler.config.first_hour = 7;
scheduler.config.auto_end_date = true;
scheduler.config.details_on_create = true;
scheduler.config.details_on_dblclick = true;
myReportLayout.cells(“a”).setText(“Calendario:”);
myReportLayout.cells(“b”).setText(“Detalhes:”);
myReportLayout.cells(“c”).setText(“Log de Atividades:”);

myReportToobarList = myReportLayout.cells("c").attachToolbar({
icon_path: "common/imgs/",
xml: "xml/MyReportPagedhxtoolbar.xml"
});

myReportToobarList.attachEvent("onClick", function(command){
	switch(command) {
	  case 'New':
	  	//	alert("New");
		myReportLayout.cells("c").collapse();
		myReportLayout.cells("b").expand();
		addComments();

		break;
	  case 'Close':

		TextContent = myEditor.getContent();
		InsertReportData(idReport, TaskID, Time, TypeAction, Description, NextMoves, TimeEdited, Erased);
		break;
		default:
	}
});


myReportList = myReportLayout.cells("c").attachList();
myReportList.define("type",{
template:"<span class='dhx_strong'>#Time#</span>#TypeAction# - #Time# <br/><span class='dhx_light'>#Description#</span>"

});
myReportList.load(“data/ReportListDataViewConnector.php”);
scheduler.config.icons_select = [
“icon_report”,
“icon_details”,
“icon_edit”,
“icon_delete”
];
scheduler.locale.labels.icon_location = “Report”;

// adding an extra button to the lightbox
scheduler.config.buttons_left = ["dhx_save_btn","dhx_cancel_btn","report_button"];
scheduler.locale.labels["report_button"] = "Report";

myReportLayout.cells("a").attachScheduler(new Date(), "day");
myReportLayout.cells("a").setWidth(400);
myReportLayout.cells("a").setText("Calendario:");
scheduler.setLoadMode("month")
scheduler.load("data/SchedulerEvents.php", "json");
var dp = new dataProcessor("data/SchedulerEvents.php");
    dp.setTransactionMode("REST"); // use to transfer data with REST
dp.init(scheduler);


	scheduler.attachEvent("onClick", function (id, e){
		   console.log("id =" + id + " e = " + e);
		   return true;
	  });		

scheduler._click.buttons.location = function(id){
alert("location");
};
scheduler.attachEvent("onLightboxButton", function(button_id, node, e){
		if(button_id == "report_button"){
			console.log("node =" + node + " e = " + e);
			alert("Report");
		}
	});
}


		ReportTableForm = myReportLayout.cells("b").attachForm();
		ReportTableForm.loadStruct("json/ReportActionForm.json");
		currentRecord = 1;
		ReportTableForm.loadStruct("data/ReportsFormData.php?id="+currentRecord);
		var dpReportTableForm = new dataProcessor("data/ReportsFormData.php");
		dpReportTableForm.setUpdateMode("row");
		dpReportTableForm.setTransactionMode("POST", true);
		dpReportTableForm.init(ReportTableForm);

		ReportTableForm.attachEvent("onButtonClick", function(id){
			if (id == "SaveFormData") {
				ReportTableForm.save();
				//alert("Saved");
			}
		});

}`

Bizzwizz

Please, note that the sources of the dhtmlxSuite components should be included on the page after the sources of the dhtmlxScheduler.
Also, please, note, the the dhtmlxForm sources are already included in the dhtmlx.js, so there is no need to include the dhtmlxForm.js together with the dhtmlx.js, to prevent different versions messing and the scripts overwriting.

If the problem still occurs for you please, provide a complete demo, where the problem can be reproduced locally.

Dear Sematik,

I will check those and return to you with results.

Thanks.

Dear Sematik,

I have verified and the schuduler 5.2.1 does not work with the dataprocessing. I solved my problem by saving the data using ajax.
Other than that the library works very well.

Ed