form values are not saved when i use button in toolbar

Hi,
I use dhtmlx 3.0suite and I have attached a layout toolbar to save the data in my form but when I click the save button only data item that no longer have the focus are taken into account.
If I use buttons that are on my form all data are taken into account.
It seems that when the focus remains on the last modified data are not saved.
To force the registration of all the data I need to finish the last edition of the field by removing the focus manually.

How to save all changes with “myForm.save()” ?

I used the example after, I just added a toolbar and code to save data with toolbar.

http://docs.dhtmlx.com/doku.php?id=dhtmlxdatastore:datastore_example_server-side
My Save button in form use this code (work fine)

//--- Create/Update/Delete operations ---	
	myForm.attachEvent("onButtonClick", function(id){
			if (id=='save'){
				myForm.save(); //saves the made changes				
			}
    });	 

My Save button in toolbar use this code (the last change is not saved)

//-- Toolbar de la page
	var dhxToolbar = layout.cells("b").attachToolbar(); // returns toolbar object
	dhxToolbar.setIconsPath("menus/imgs/");
	dhxToolbar.addButton("sauve", 0, "Sauve", "save.gif", "save_dis.gif");
dhxToolbar.attachEvent("onClick",function(id){   
        if (id=='sauve'){
		//alert("Sauvegarde effectuée.");
		myForm.save();
	}		
    });

Look this topic: here is attached a new fixed dhtmlxForm

viewtopic.php?f=5&t=22544#p72502

Thank you for the information.
I tried this new file but does not solve my problem.
I always have to click outside the field for the last change to take account if i use the button on the toolbar and “myForm.save()” function.

Please attach the complete demo that reproduces the problem. Locally form.save() sends data correctly to server regardless whether there was click or not (We tested the form library from viewtopic.php?f=5&t=22544#p72502 post).

Hi,
Effectively Locally form.save() sends data correctly to server but not when i use form.save() from a toolbar.
i attach a demo asap.

Hi,

please also check that myForm is visible variable inside onClick handler of Toolbar

Hi,
My form is clearly visible as when I put the focus to another item before saving the data with myForm.save () it works correctly from the toolbar.
The other way is to do an alert (“Save OK”); myForm.save before () and all data is saved as in the code below.

//-- Toolbar de la page
   var dhxToolbar = layout.cells("b").attachToolbar(); // returns toolbar object
   dhxToolbar.setIconsPath("menus/imgs/");
   dhxToolbar.addButton("sauve", 0, "Sauve", "save.gif", "save_dis.gif");
dhxToolbar.attachEvent("onClick",function(id){   
        if (id=='sauve'){
      alert("Sauvegarde effectuée.");
      myForm.save();
   }      
    });

Hi,
See attach file with complete demo with mysql dump and all the files used.
Best regards
testDemo.7z (899 KB)

Hi,
You are not using dhtmlxform.js that I recommended in the previous reply. Try to include it in your page.

Hello,

Effectively the recommanded file is named dhtmlxform.jsnew2 in my demo but I tried it and I did not get the desired result.

In this second test with this new file I replaced the original file dhtmlxform.js dhxSuite3.0 by the new, I erased the history of the internet explorer and refreshed the page but the problem is the same.
I tried with IE, FF, Chrome but the last modified field is saved only if i click outside the field when I use the button in the toolbox.

I think I have tested under the right conditions but if I’m wrong tell me.
The new file dhtmlxform.js is taken into account by inserting this code or not ?

<script src="codebase/dhtmlx.js"> </ script> 

Best regards

You may download this file:
download/file.php?id=4672

and put it to you directory and add in the library such way:

<script src="dhtmlxform/codebase/dhtmlxform.js"></script>

Hi,
Thank you for your help, the problem is partially solved after inserting the library but …

The last(or before last) dhtmlForm.js works only if i add the library in a special order like this :

<link rel="STYLESHEET" type="text/css" href="codebase/dhtmlx.css" />
<script  src="codebase/dhtmlx.js"></script>	
    <script src="dhtmlxform/codebase/dhtmlxform.js"></script>
    <script type="text/javascript" src="php/codebase/connector.js"></script>
	<script type="text/javascript" src="dhtmlxDataStore/codebase/datastore.js"></script> 
	<script>
		window.dhx_globalImgPath="codebase/imgs/";
	</script>

With this new library the appearance of form buttons is truncated.
Before the addition of the library the buttons in the form were displayed very well why not with the new library ?

Try to add this style to your form:

<style> .dhxlist_obj_dhx_skyblue div.dhx_list_btn td.btn_m div.btn_txt { padding: 1px 1px; } </style>

Hi,
Thank you for all your replies, adding the new style has corrected the latter problem.
Everything works as desired, the grid, the form and its buttons, the toolbar and buttons, and data backup.
Solved.