WEBDEV Concepts

148 Part 4: Advanced concepts How to manage the "Back" button? To manage the "Back" button, you can use: • the page synchronization code in Session mode . This code is called in case of desynchronization. • a hidden Edit control (invisible Edit control) to identify the record displayed in the browser. • the option "Call the page synchronization process if the user pressed the browser Back button" on your buttons and/or links ("Advanced" tab of the button description). You can choose and combine either of these options according to the type of action that can be performed in the page in Session mode. Detailed example of how to manage the "Back" button A dynamic page is used to browse the different products of a site. The buttons found in the page are as follows: • Back to main menu This action requires no specific management of the "Back" button. This button does not handle data files: a desynchronization between the context and the page displayed has no effect. • Delete the current product The "Delete the current product" action handles a data file. It is important that the deleted record corresponds to the record viewed by the user. To manage the "Back" button, we recommend that you use: • a hidden (invisible) control in the dynamic page: this control will contain the identifier of the record actually displayed in the browser. • the synchronization code: this code is used to update the context (search for the record viewed by the user). The actions performed in the synchronization code will be: 1. Re-read the record corresponding to the identifier stored in the hidden control. 2.  If the record is not found: an error page is displayed and the code of "Delete" button is not run. 3.  If the record is found, the page context is automatically modified on the server: the code of "Delete" button is run. Total security!

RkJQdWJsaXNoZXIy NDQ0OA==