Having problems with databaseManager.setAutoSave(false) - Servoy always saved the records, irrespective of AutoSave state - I checked the onRecordSave event, as suggested by Adrian's post. I am using rc2 on MacOS X 10.4.7, with a MySql 5.0.24 database.
When I move from one record to the next or the previous one, the onRecordSave event is fired as many times as the number of records in the foundset less 1: if there are 5 records, onRecordSave is activated 4 times by the same record, if the records are 4 it is fired 3 times and so on. When a new record is added the onRecordSave event is then fired once more and this for ANY record in the foundset I move from.
To check this I linked this method to the onRecordSave event of a form (i tried it with three different forms, same behaviour)
- Code: Select all
var saveStatus = databaseManager.getAutoSave();
plugins.dialogs.showInfoDialog("","Save " + saveStatus + " " + tb_testid,"Ok");
where saveStatus var shows whether AutoSave is false or true and tb_testid is the id number of the record.
When I moved from record 21 (in a six records foundset) I got this message repeated 5 times: "Save false 21". When I moved from record 20 the message, again repeated 5 times, was "Save false 20", and so on.
To observe this behaviour you must move from one record to another after modifying one. In fact the first time you move through the records the onSave Record event is triggered just once, but if you move a few records up or down, voila...
Besides that, although AutoSave is set to false, modified records are always saved without issuing any save data command.