This tutorial explains how to commit changes a user makes to the application data back to the database. It continues from the “Regions” application built in the “How to delete a row” tutorial and adds a save button to the application.
Open the “regions_pkg” package in your favorite PL/SQL Editor and add a procedure named save which calls the “api_application.doCommit” to apply updates made in your application to thedatabase. Ensure that the procedure is exposed in the package specification.
procedure save is begin api_application.doCommit; end;
In Formspider IDE, create an action named “save” that calls the “regions_pkg.save” procedure.
Open the “Regions” application in Formspider IDE and double click the “topPanel” to edit. Add a button labeled “Save” to the “topPanel”. Call the “save” action from the buttonPress event of this button.
<panel> <tableLayout> <row> <cell> <button label="New Region"> <events> <buttonPress action="createRegion"/> </events> </button> </cell> <cell> <button label="Delete Region"> <events> <buttonPress action="deleteRegion"/> </events> </button> </cell> <cell> <button label="Save"> <events> <buttonPress action="save"/> </events> </button> </cell> </row> </tableLayout> </panel>
Click the “Save” button in the Formspider IDE to save your changes. Run the Application. Create, Edit or Delete a region. Click the save button in the “Regions” application to see your changes committed to the database.