Data saving issue!

Hello, I have come across the following issue:

I have a form in table view and a form of the same table in record view. On one of the fields I have an onAction event that shows the rcord view form in a dialog. The user can edit data and close the window, coming back to the table view. Now the problem:

In 9 out of 10 cases the data that is entered is not saved!? The table view never reflects the changes made and when entering the record view the changes are gone as well.

Am I missing something or is this a strange but unpleasant bug?

Servoy 2.1 b4. Sample solution attached.

Is this because you are almost never actually exiting the record in table view and the same from the showFormInDialog so that very rarely is the data being committed to the table ?

The behaviour disappears if you place a controller.saveData() both before and after the showFormInDialog as in :

controller.saveData()
application.showFormInDialog( forms.tabelle_einzeln, -1, -1, -1, -1, ‘test’)
controller.saveData()

Harry

What doesn’t help is a controller.save after editing and I can’t really understand why I should save something before I even do something… (althought I observed that it does help). Futhermore I think that every editing should be saved no matter what form I am in except I start a transaction.

I agree with you - I am just speculating why it is happening !

I wonder if the issue revolves around when does a field lose focus ?

That is, if Servoy thinks that you are still editing the field even though you have opened a form in dialogue then it cannot write the data to the table !?

Harry

the problem is that you are doing something before you are opening the formdialog.. You are setting the record in edit mode and you are starting to edit the textfield.

If for example you open the dialog through a button you see that it goes well. Or if you call savedata before opening the dialog then also everything goes well.

But i changed it a little bit so that what is currently being seen on screen is commited to the row data (but not yet in the DB) right before you open the dialog.
So it should be OK now in 2.1B5

Thanks for the fix. I think that an onAction should always save outstanding changes, shouldn’t it? Usually with onAction you are about to do something else, so you’d expect your changes before the event to be saved.

no on action won’t trigger a save (not to the database!)
this wil trigger many problems for example

if you have a record where you have to specify a certain value. That value is being lookup through a Dialog. Then the trigger that shows that dialog shouldn’t save the data because then the db starts complaining.