Form bound to grid with datastore

I’m having a really weird issue trying to edit a grid using a form attached to a popup window. I’ve used

[code]var tasks = new dhtmlXDataStore({
url:“example.php”
});

tasks.data.scheme({
Subject:“New Task”
});
dp3 = new dataProcessor(“php/updateTask.php”);
dp3.init(tasks);
dp3.enableDataNames(true);

	//Connect grid to datastore
	grid3.sync(tasks);

form3e.bind(grid3); [/code]
When I select a row in the grid and open the form to edit it, the data displays in the form, but when I save the changes it doesn’t update the grid. Instead I get several errors:

and

.

Here’s where it gets weird. If I close that window, select a different line in the grid and open the edit form, my changes now save. The first selection always fails; after that everything works. What could be causing this?

Does first selection was done by clicking on the grid or by some API call ?
The above error is similar to the case, when you have not selected master record at all but form pushes data back to store ( it can’t find related record, which causes error )

Setting the cursor to the correct row in the grid seems to have fixed it. Thanks!