Problem saving data from Form(=Grid Bind) to MySQL Database

Hi

3 hours that I’m trying… I give up and now ask for your help.

I setup a small application with a grid and a Form.

The Grid takes its information from a MySQL Database.
The Form is linked to the field of the Grid through a Bind() call.

The form is correctly displaying the information depending on selected line in Grid.
When I modify the grid content, modifications are correctly sent to DB.

Problem : when I modify a field in the Form and click the save button (Form.save() action), information is correctly updated in the grid, but no update in done in the DB.

What must I do in order to send back the updated information to the Database ? I tried playing with connectors without success, I also tried to the selected grid line save, etc.

Here is the Form declaration (liste_adherents is the Grid):

	var str = [
	{type: "input", name:"cPrenom", label: "Prenom"},
	{type: "input", name:"cNom", label: "Nom"},
	{type: "checkbox", name: "cDossierOK", label: "Dossier"},
	{type: "button", name:"save", offsetTop:10,  value:"Submit"}
	];
	var fiche_detail = detail_adherent.attachForm(str);
	
	fiche_detail.bind(liste_adherents);

 	//---handler for buttons' clicks	
	fiche_detail.attachEvent("onButtonClick", function(id){
		fiche_detail.save(); //saves the made changes
    	});

Sorry for this Newbee question if it appears as one for any skilled DHTMLX user.

Regards
Matt

Aside from this question, I have another one which could be link : how can I create my own SQL request to send a SQL query to the database ?

For example, if anybody shows me how to create a PHP file, which connect to the DB and execute a query like :

UPDATE myTable SET name=[info_provided_as_php_argument] where idItem=[info_provided_as_php_argument]

would save me a lot of work.

I’m pretty easy with SQL requests… but do not know how to execute them for now :slight_smile:

Thanks for this additionnal help !

Matt

Do you have in grid initialization something like

var dp = new dataProcessor(“some_connector.php”);
dp.init(mygrid);

Lines like above one will enable data saving in grid, and when data is pushed from the form it will trigger data-sending to the server side.

Hi

yes, that’s why I wrote “When I modify the grid content, modifications are correctly sent to DB.”

The dataprocessor is then working fine : when I update data in the grid itself, data is pushed to Database… but nothing happen if data is modified from the Form after a button click that pushes Form data to the Grid.

Reagrding my second message, I’am trying to deal with “beforeUpdate” trigger… but it does not trig (the basic update action remains called)

Matt

Hi

for your information, still not successfull… I tried many things with no luck.

Modified data directly in grid is correctly pushed to Database.
Updated data in Form is pushed to Grid by a the click on the Save button (Form.save() call), but nothing is next pushed to the Database.

To try: ks369381.kimsufi.com/hebergement … rents.html

Thanks for any additional help.

Regards
Matt

Hi

well, I finally decided to abandon the bind() use.

I set up a solution derived from the Contact Manager example (docs.dhtmlx.com/doku.php?id=tuto … ct_manager)

Matt

If you are changing data by using grid’s API, you need to call after that something like

griddataprocessor.setUpdated(row_id);

it will mark row as updated and will trigger sending data to the server side