Form binding Grid without dhtmlxDataStore

Hi support team,

I have the following question about dhtmlxForm and dhtmlxConnector.

  1. Is there the way to bind a form with a grid without using dhtmlxDataStore?

  2. dhtmlxForm provide send() and save() function to communicate with server. Does the save function including both cases of insert new data at the form to DB and update data at DB?

Thanks.

Boa

Yes, you still need to include dhtmlxdatastore.js but link form directly to grid as

myform.bind(mygrid);

now, when record selected in the grid, it will be shown in the form.

dhtmlxForm provide send() and save() function to communicate with server.
Yes, if saving operations has not load command before it - insert operation will be executed on server side.
Also you can force required kind of operation

form.resetDataProcessor("inserted"); form.save();

or

form.resetDataProcessor("updated"); form.save();

Hello Stanislav,

I used the second one, it still does not work. It update the record at the grid, but does not save data into DB.

	var formMarker = dpFrmMarker = null;
		if (formMarker == null) {
			
			var formData = [......];

			formMarker = layout.cells("b").attachForm(formData);

			//--- binding the form to the grid. Presenting record's details in the form ---
			formMarker.bind(myGrid);
			formMarker.setSkin("dhx_skyblue");
			formMarker.attachEvent("onButtonClick", function(name) {
				if(name=="print_details") {
					formMarker.setItemLabel("lblMsgValidate", "Print Details not ready yet.");
				} else if(name=="save") {
					// If valid save data and reload grid markers
					if (formMarker.validate()) {
						formMarker.resetDataProcessor("updated");
						formMarker.save();
						formMarker.setItemLabel("lblMsgValidate", "Saved Changes");
					} else {
						// form is not valid or filled in correctly
						formMarker.setItemLabel("lblMsgValidate", "Form is NOT Valid");
					}
				}
			});
			dpFrmMarker = new dataProcessor("xml_connector.php?requestType=getApplicateForm");
			dpFrmMarker.init(formMarker);
		}
		else 	{
			if (myGrid.getSelectedId()) {
				rowIndex = myGrid.getRowIndex(myGrid.getSelectedRowId());
				formMarker.load("xml_connector.php?requestType=getApplicateForm&id="+myGrid.getSelectedId());
			}
		}

Above answer was related to the case when form is used without binding to the grid.

If form was assigned to grid, the only way to add new record - add new row to the grid and select it - it will be show in the form.

form.save() normally saves data back to the server side, but when form was bind, it just push data back to master, which in above case means back to grid.