How to detect a page refresh using javascript on APEX? - oracle-apex

My goal is to do some javascript action the moment the user clicks the browser's refresh button.
I've tried:
Function and Global Variable Declaration
function pageunload(){
alert('here');
};
Execute when Page Loads
window.addEventListener('beforeunload', pageunload);
I know that the 'addEventListener' is working properly but the event is not the right one.
I have also tried to dynamic action "before Refresh", but I haven't been able to associate it to the page level, only items/regions etc.

In the page attribute you can write Javascript on Page Load which will be executed when the page is reloaded or submitted.

beforeunload is the opposite of what you want
Use the load event
Check Mohamad image
Create a dynamic action for page Load

Related

Interactive filters set on page load only show up after manual refresh

I am setting up dynamic filters for the IG using new APEX_IG package method add_filter. So from Page 1 I click oin the link to go to Page 2 where I have interactive grid. Through that link I set a couple of page items on page 2 and based on those items I create filters using APEX_IG.ADD_FILTER. So the setting of the filters has to be done on PAGE_LOAD.
On page load I use a DA that calls APEX_IG.ADD_FILTER if a specific page item is not null. When I open the page first time, I do not see the filters applied, they only show up after I manually refresh the page. I added a refresh action for the IG after executing ADD_FILTER but that does not do anything - in order to see the change I still have to manually refresh the page.
I cannot add any refresh action or submit page action under page load since that will refresh the page repeatedly. What is the best way to programmatically refresh the page after applying or removing the filters?
If the issue is just on page load, you could add the call to APEX_IG.ADD_FILTER in a pre-rendering page process instead of a dynamic action. This works fine for me. This blog also explains that a full page refresh is needed.

Apex Oracle : How to refresh Page Item?

I have a page Item on Apex 19.2
In page validation where i'm setting the value of the item : P1_MyItem. The value is set properly in session state. However it's not reflected immedialy in the html item. I still need to reload the page to get the right value in the item.
Is there any way to reflect it immediatly please ? (without reloading the page)
Thanks.
Cheers,
You need to ensure Items to Return lists any item that is updated within the PL/SQL, that you would also like updated within the web page once the dynamic action is completed.
As opposed to 'Items to Submit', which sends any information in pages items the browser is aware of to the database, before execution of the PL/SQL block.
Page processing now defaults to using Ajax. So, if a validation error occurs, the page is no longer re-rendered by default because the assumption is that validations will not change session state. If you want to see your changes, you'll need to locate the page property named Reload on Submit and set that to Always.
But, of course, that means the page will be re-rendered/re-loaded which is what you're trying to avoid.
Also, it's not possible to set the page property to Reload on Submit if you want to use an Interactive Grid on the same page. It requires the option Only for Success, so you have to refresh the page item somehow else.

How to handle bootstrap button without any href in Jmeter?

Im trying to test performance for a web app and I'm currently blocked on a page which has submit button without any hyperlink.
How do I navigate to the next page?
This is the button im trying to use to navigate to the next page: Next
I tried using the CSS selection extractor in Jmeter, its reading the value of the button(I can see in the debug sampler) but without any hyperlink im unable to use that as a path for navigating to next page. Debug Sampler
Jmeter (not webdriver sampler) works on request level and not on gui level. So, you need to capture the request to navigates to the next page and not to click on the button.
Try jmeter recording. or directly put the path of the landing page in a new http sampler manually.
Hope this helps.

oracle apex page stops execution after calling report query

I have an oracle apex page that saves the data to a table while page processing ,when a button is clicked. After this I call a report query and generates a pdf report.After the pdf report is generated, the page stops execution without completing the page submit action. Hence the page items do not get refreshed and the page do not reloads. The control goes to the newly generated pdf report. Anybody have a solution for this?
Edit
A button 'SAVE' is created for calling the report query 'SLIP'. Then inside the page a dynamic action is created . javascript code is written inside DA. This javascript will submit the button using the code
apex.submit('SAVE')
A pl/sql page process is also created for this save button. This will work after above JavaScript code is executed at point 'processing'. After this, report query 'SLIP' is called and pdf report is generated and it is opened in adobe reader. Then the page stops executoin, page do not gets submitted . The page item values will not be cleared and the page do not reloads. That is the issue I'm facing
Use JavaScript Code:
apex.submit('BUTTONNAME');

Oracle APEX Select RDS Tab in URL

I am developing an application in Oracle APEX 5.1. I have a page which uses a region display selector. The default tab has general information which should be the active tab for anyone navigating to the page from within the app. The other tabs are detailed reports which are relevant to specific users. I want to provide these users with a URL to access the tab containing the reports that they're interested in.
I created a page variable, P14_ACTIVE_TAB, which is the static ID of the region associated with a particular tab. I use this variable in the following JavaScript code..
selectTab = "$('#myRDS .a-Tabs').aTabs('getTabs')['#" + $v('P14_ACTIVE_TAB') + "'].makeActive();";
console.log(selectTab);
eval(selectTab);
I have tested the code and it works correctly if I use it on a button, select list, etc. however I have been unable to get it to properly execute when a user navigates to the page using a URL like
f?p=100:14:::::P14_ACTIVE_TAB:myReport
If I define a dynamic action on page load it appears that the page is being rendered after the code is executed so I still get the default tab. If I look at the console output I see the correct code, which I can then cut/paste as a console command to get the desired result. So it appears that I have the right code being executed at the wrong time.
Does anyone have any suggestions how I can define the dynamic action to execute after the page has been rendered so the correct tab will be made active?
Thanks.