setAutoSave() not working as expected?

Hi Folks - this is exasperating as I cant fathom where the errors might be?

I have a form with just 3 text fileds on it. I have a couple of buttons - next/prev record, save and new.
There are no onDataChange checks.

I have a test button too which is for me to check if the form (foundset I guess) has any changed data that is not saved.
OnShow of the form sets databaseManager.setAutoSave(false), and for test purposes I do the same again in onRecordSelection(). This is not reset to on anywhere in the form code.

Problem: When I change data initially and test for it on my button it shows true as expected (it runs) ```
application.output('Changed Data ?; '+databaseManager.hasRecordChanges(forms[event.getFormName()].foundset,1))

I catch the 'has data changes' prior to the next record code then select the next record```
forms[event.getFormName()].controller.setSelectedIndex(forms[event.getFormName()].controller.getSelectedIndex()+1)

If the user chooses to he can save that data. However, when moving to the next record after the save I can edit the data and it appears that the record is not edited - using my test button the record shows false for data changes??? I can move from the record that I have just changed and the data is actually saved - though autosave is off.

Nowhere in the code is autosave turned on again, yet the movement from one record to another causes it to act as if it were.

Have I missed something? Is there something I should be doing to ensure the correct record is being checked

Hi Ian,

Seems you are always checking the first record in the foundset no matter what.

databaseManager.hasRecordChanges(forms[event.getFormName()].foundset,1)

That should be:

databaseManager.hasRecordChanges(forms[event.getFormName()].foundset, forms[event.getFormName()].foundset.getSelectedIndex())

Or just pass the record itself:

databaseManager.hasRecordChanges(forms[event.getFormName()].foundset.getSelectedRecord())

Hope this helps.

Doh… :oops: I was thinking that the argument 1 was actually limiting the check to the current record in the foundset not the first index…

Thanks Bud, sanity check whilst I still have some hair! LOL.