Error on saving a record

Hi all,

I have the following method to save the record and have two issues with that I like to resolve:

var message = "";
message += 'Do you want to save the change?\n'
var thePressedButton =  plugins.dialogs.showInfoDialog( 'Result',  message,  'OK', 'No')
if (thePressedButton != 'OK')
        {
        return;
        }


else if (thePressedButton == 'OK')

        {
          controller.saveData();
          message += 'Record saved.\n';
           currentcontroller.loadOmittedRecords();
          }
  1. I like to make sure if users select NO then the new record or the changes will not commit to the table.

I already have a method that onShow calls for application.setFocusLostSaveEnabled(false);

  1. If users select OK then if there is any error from backend DB or any other sources then return the error to the client screen.

I have already used databaseManager.startTransaction(); and databaseManager.rollback Transaction(); but no success.

Thanks for any help.

Abrahim

First you have to make a method that sets the auto save off, on the onShow() or maybe when a user hits a edit button

databaseManager.setAutoSave(false)

and then your save method should be:

var message = "";
message += 'Do you want to save the change?\n'
var thePressedButton =  plugins.dialogs.showInfoDialog( 'Result',  message,  'OK', 'No')
if (thePressedButton != 'OK')
{
	databaseManager.rollbackEditedRecords()
    return;
}
else if (thePressedButton == 'OK')
{
	controller.saveData();
	message += 'Record saved.\n';

}

Sanneke,

Thanks for the help,

Abrahim

Hi Sanneke,

I just found out that in Servoy 3.X users have not been getting informed about any error if there was a problem saving the record. We used to get some kind of error if there was a problem with inserting a record.
What has been replaced the Servoy standard error capture?
How do we capture the error and pass it to the Servoy client screen?

We are using Servoy version 3.1.6.

Thanks,

Abrahim