Requirement: I have a button on my APEX page with the name as “Click to Reload Page“.
Now when user click on the “Click to Reload Page” button, it should reload or refresh the whole page.
Also, to address this requirement I want to Execute a JavaScript code. I will call the location.reload() function here to reload the page.
Explanation on location.reload() function: The location.reload() method reloads the current URL, like the Refresh button.
The reload may be blocked and a SECURITY_ERROR DOMException thrown. This happens if the origin of the script calling location.reload() differs from the origin of the page that owns the Location object.
Solution: For solution of the above requirement follow the steps as shown below:
Step 1: Create a Region inside a page and set the Title as Reload Page
Step 2: Create a button inside the Region and set the below properties for the button.
- Name: P2_RELOAD_BTN
- Label: Click to Reload Page
Step 3: Create a Dynamic Action for the P2_RELOAD_BTN button and set the Name as reload_btn_clicked
Step 4: Set the Properties of the True outcome as shown below
- Action: Execute JavaScript Code
- Code: location.reload();
Save and run the application. Thus, the ran application is shown below:
Click on “Click to Reload Page” button and with that the page will be reloaded or refreshed again.
Hence, the solution to our requirement.
If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.
Thanks & Regards,
Susanto Paul
1,209 total views, 1 views today