Sign Up

Hey, Dev!
Are you looking for a forum full of active developers to help you?
So if you want to:
➡️ Get answers for your development issues
➡️ Help others
➡️ Write an article
➡️ Get rewarded for your active participation
Then you are going to love this place.

Have an account? Sign In


Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have a permission to ask a question, You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

OrclQA.Com

OrclQA.Com Logo OrclQA.Com Logo
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Blog
  • New Questions
  • Tutorials
    • Oracle Apex
    • Python
  • Tags
  • Users
  • Badges & Points
  • About
Home/Questions/Q 332
Answered
pavlos
pavlos

pavlos

  • 16 Questions
  • 61 Answers
  • 0 Best Answers
  • 168 Points
View Profile
  • 1
pavlosProfessional
Asked: September 6, 20202020-09-06T19:16:01+05:30 2020-09-06T19:16:01+05:30

How to reset page item when page is reloaded in Oracle Apex

  • 1

How to set page item to null, when browser is reloaded. I tried with DA after refresh but, it works only when I change page inside application not for reload page on browser button.

oracle apexquestion
  • 21
  • 1k
  • 0
  • 1
  • Share
    • Share on Facebook
    • Share on Twitter
Answer

    21 Answers

    1. Vinish

      Vinish

      • 1 Question
      • 416 Answers
      • 39 Best Answers
      • 2k Points
      View Profile
      Vinish Legendary
      2020-09-07T06:48:02+05:30Added an answer on September 7, 2020 at 6:48 am

      Create a before header process as a clear session state and set the clear all items on the current page from the drop-down for the Type setting or specify the specific items.

      Below is the screenshot:

      Oracle Apex: clear session state.

      Please let me know if any questions.

      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
    2. pavlos

      pavlos

      • 16 Questions
      • 61 Answers
      • 0 Best Answers
      • 168 Points
      View Profile
      pavlos Professional
      2020-09-07T12:54:31+05:30Added an answer on September 7, 2020 at 12:54 pm
      This answer was edited.

      Thanks for your response Vinish!

      I tried, but on this page, I can set the value for the item, when I do that the page is submitted. and the item is always null

      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • Vinish

        Vinish

        • 1 Question
        • 416 Answers
        • 39 Best Answers
        • 2k Points
        View Profile
        Vinish Legendary
        2020-09-07T14:24:13+05:30Replied to answer on September 7, 2020 at 2:24 pm

        Ok, if this is not working, then try to create a dynamic action on page load and set the action as Set Value. Below is the screenshot:

        Oracle Apex dynamic action on page load.

        If more than one item, then change SQL as follows:

        Select null n1, null n2, null n3 from dual

        Then set the affected items also.

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
    3. pavlos

      pavlos

      • 16 Questions
      • 61 Answers
      • 0 Best Answers
      • 168 Points
      View Profile
      pavlos Professional
      2020-09-08T14:40:05+05:30Added an answer on September 8, 2020 at 2:40 pm
      This answer was edited.

      Sorry, I think I didn’t explain well.

      I’ve created a demo app you can take a look here

      Workspace: apex1, user: testuser, password: 73s7us3r!@#

      You can set the value of the item by clicking the button. When the value of the item is set, and I reload the page on the browser reload button, I want to set the item to null.

      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • Vinish

        Vinish

        • 1 Question
        • 416 Answers
        • 39 Best Answers
        • 2k Points
        View Profile
        Vinish Legendary
        2020-09-08T14:50:50+05:30Replied to answer on September 8, 2020 at 2:50 pm

        The method I suggested above should clear your items.

        I saw your demo application, I can not see the source code of your application, but I doubt that your Set Value action is executing on the page reload.

        Please turn-off the Fire on Initialization for the Set Value action.

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
      • Vinish

        Vinish

        • 1 Question
        • 416 Answers
        • 39 Best Answers
        • 2k Points
        View Profile
        Vinish Legendary
        2020-09-08T15:01:06+05:30Replied to answer on September 8, 2020 at 3:01 pm

        I opened your app to see the code, but I think you changed. Can you revert it?

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
        • pavlos

          pavlos

          • 16 Questions
          • 61 Answers
          • 0 Best Answers
          • 168 Points
          View Profile
          pavlos Professional
          2020-09-08T15:04:17+05:30Replied to answer on September 8, 2020 at 3:04 pm

          I deleted DA, now it’s like before.

          There is no DA, I tried with and doesn’t work.

          • 0
          • Share
            Share
            • Share on Facebook
            • Share on Twitter
      • Vinish

        Vinish

        • 1 Question
        • 416 Answers
        • 39 Best Answers
        • 2k Points
        View Profile
        Vinish Legendary
        2020-09-08T15:04:45+05:30Replied to answer on September 8, 2020 at 3:04 pm

        Oh, finally I checked your code.

        On button click, you are redirecting to the same page by setting the item value to 1.

        Which is now impossible to set as null.

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
        • pavlos

          pavlos

          • 16 Questions
          • 61 Answers
          • 0 Best Answers
          • 168 Points
          View Profile
          pavlos Professional
          2020-09-08T15:07:35+05:30Replied to answer on September 8, 2020 at 3:07 pm
          This answer was edited.

          Thank you Vinish, sorry for a bad explanation.

          I added DA after refresh and this DA set value for the item to null when I change page or click on the same page in the menu. But, doesn’t work for reload.

          • 1
          • Share
            Share
            • Share on Facebook
            • Share on Twitter
    4. Vinish

      Vinish

      • 1 Question
      • 416 Answers
      • 39 Best Answers
      • 2k Points
      View Profile
      Vinish Legendary
      2020-09-08T15:56:29+05:30Added an answer on September 8, 2020 at 3:56 pm

      The clear session state method should work. I tested here already.

      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • pavlos

        pavlos

        • 16 Questions
        • 61 Answers
        • 0 Best Answers
        • 168 Points
        View Profile
        pavlos Professional
        2020-09-08T16:10:04+05:30Replied to answer on September 8, 2020 at 4:10 pm

        When I add before header process, type: Clear Session State like in your answer, the item is always null I can’t set the value.

        I added to the demo app, you can take a look.

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
        • Vinish

          Vinish

          • 1 Question
          • 416 Answers
          • 39 Best Answers
          • 2k Points
          View Profile
          Vinish Legendary
          2020-09-08T16:32:09+05:30Replied to answer on September 8, 2020 at 4:32 pm

          I have modified the application now, please check.

          First of all, when we set a page item using the redirect to page option the session state is set and the page will reload. Then the item session state can not be cleared when reloading or refreshing the page. And if we will call the clear session state at this point it will make the null always as it is doing it already.

          So I have changed the way of setting item value, using the Set Value DA, and now when you will set the item value and will refresh the page the item will set to be null because of the clear session state process.

          But I understand that if your requirement is to call the page using the redirect option, then you won’t be able to make items null on page refresh because the item state is set and page loading is in progress.

          Please let me for further questions.

          • 0
          • Share
            Share
            • Share on Facebook
            • Share on Twitter
        • pavlos

          pavlos

          • 16 Questions
          • 61 Answers
          • 0 Best Answers
          • 168 Points
          View Profile
          pavlos Professional
          2020-09-08T16:54:11+05:30Replied to answer on September 8, 2020 at 4:54 pm
          This answer was edited.

          Works now but, I use links which set item value and should change IG report on click. For that, I need to submit the page.

          • 1
          • Share
            Share
            • Share on Facebook
            • Share on Twitter
    5. Vinish

      Vinish

      • 1 Question
      • 416 Answers
      • 39 Best Answers
      • 2k Points
      View Profile
      Vinish Legendary
      2020-09-08T17:01:44+05:30Added an answer on September 8, 2020 at 5:01 pm

      Then, in this case, you just can’t expect the items to clear on just page reload/refresh.

      • 1
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
    6. Vinish

      Vinish

      • 1 Question
      • 416 Answers
      • 39 Best Answers
      • 2k Points
      View Profile
      Vinish Legendary
      2020-09-09T07:58:02+05:30Added an answer on September 9, 2020 at 7:58 am

      Hi Pavlos, after a little research I found the solution and I take my words back that it can not be done 😅.

      Create a dynamic action on Page Load as Execute JavaScript code and add the following code in it:

      if (performance.navigation.type == performance.navigation.TYPE_RELOAD) {
      apex.item("P15_NEW").setValue("");
      }

      You can set all item values to null between the above if condition. I tested and it is working fine.

      Please test and let me know if it works for you.

      • 1
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
    7. pavlos

      pavlos

      • 16 Questions
      • 61 Answers
      • 0 Best Answers
      • 168 Points
      View Profile
      pavlos Professional
      2020-09-09T21:40:29+05:30Added an answer on September 9, 2020 at 9:40 pm
      This answer was edited.

      Hi Vinish!

      Thank you so much for your effort to help me, I set value for the item in column link.

      For instance, when I click in badge list on status NEW, I get records in IG where status = NEW. I see that when I reload the page, the item value still exists in URL. Although the item is NULL on the page, and IG still shows results for the old item value.

      • 1
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • Vinish

        Vinish

        • 1 Question
        • 416 Answers
        • 39 Best Answers
        • 2k Points
        View Profile
        Best Answer
        Vinish Legendary
        2020-09-10T09:08:15+05:30Replied to answer on September 10, 2020 at 9:08 am
        This answer was edited.

        Your requirement is really interesting Pavlo.

        Now I have changed the JavaScript code to redirect to the same page by setting the page item to null.

        So the DA will be the same on Page Load to execute JavaScript code. But now update the code with the following:

        if (performance.navigation.type == performance.navigation.TYPE_RELOAD) {
        javascript:window.open('f?p=&APP_ID.:15:&APP_SESSION.:::15:P15_NEW:'||'', '_self');
        }

        Here the 15 is the target page number, change it with your page number, and then the other 15 is the clear cache page, specify the same target page value. Change the item name P15_NEW to your page item.

        If you have more items then separate it by a comma. For example:

        if (performance.navigation.type == performance.navigation.TYPE_RELOAD) { 
        javascript:window.open('f?p=&APP_ID.:15:&APP_SESSION.:::15:P15_NEW,P15_NEW2:'||'','', '_self');
        }

        And notice, that the after last page item P15_NEW2 there is a colon (:) to end the page items and then concatenating the null values as (||”,”).

        I tested, and it worked. Let me know if this approach suits you.

        • 1
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
        • pavlos

          pavlos

          • 16 Questions
          • 61 Answers
          • 0 Best Answers
          • 168 Points
          View Profile
          pavlos Professional
          2020-09-10T18:17:54+05:30Replied to answer on September 10, 2020 at 6:17 pm
          This answer was edited.

          Works now but, I don’t know why the page is reloaded twice when I click on reload button.

          • 1
          • Share
            Share
            • Share on Facebook
            • Share on Twitter
    8. Vinish

      Vinish

      • 1 Question
      • 416 Answers
      • 39 Best Answers
      • 2k Points
      View Profile
      Vinish Legendary
      2020-09-10T18:44:38+05:30Added an answer on September 10, 2020 at 6:44 pm

      Yes, it will reload, because on reload, I am redirecting to the same page.

      • 1
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • pavlos

        pavlos

        • 16 Questions
        • 61 Answers
        • 0 Best Answers
        • 168 Points
        View Profile
        pavlos Professional
        2020-09-12T14:40:39+05:30Replied to answer on September 12, 2020 at 2:40 pm

        Thank you Vinish!

        I’ll consider what’s the best solution for me, in my opinion, twice reload does the job but, it doesn’t look nice.

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
        • Vinish

          Vinish

          • 1 Question
          • 416 Answers
          • 39 Best Answers
          • 2k Points
          View Profile
          Vinish Legendary
          2020-09-12T14:45:31+05:30Replied to answer on September 12, 2020 at 2:45 pm

          Ok I will try to find another solution. 😂

          • 1
          • Share
            Share
            • Share on Facebook
            • Share on Twitter

    You must login to add an answer.

    Forgot Password?

    Sidebar

    Ask Question
    Write a Post
    • Recent
    • Answers
    • Bheem

      What is best way to design school time table?

      • 0 Answers
    • OrclQA Wiki

      How to display file contents in MAC terminal app?

      • 1 Answer
    • Greg

      Displaying image in modal window

      • 3 Answers
    • Greg Grimes

      20.2 APEX: How can I pre-select the searchable column in ...

      • 0 Answers
    • Vinish
      Vinish added an answer Yes, this is also fine. January 19, 2021 at 3:25 pm
    • Greg
      Greg added an answer I tried your solution and it worked, but since I… January 19, 2021 at 3:23 pm
    • Vinish
      Vinish added an answer You can use the cat command to display file contents… January 19, 2021 at 10:41 am
    • Vinish
      Vinish added an answer You need to apply some CSS. Follow the below steps:… January 19, 2021 at 9:31 am
    • Timo Herwix
      Timo Herwix added an answer What is about the standard read- only Attribute? read more… January 17, 2021 at 4:59 pm

    Recent Blog Posts

    • Vinish

      Copy URL to Clipboard on Button Click Examples

    • Vinish

      Find When Your Mac Was Last Shutdown

    • Vinish

      Oracle SELECT Statement

    • Vinish

      Python Append List to List Example

    • Vinish

      JavaScript Object Get Value by Key

    Explore

    • Home
    • Blog
    • New Questions
    • Tutorials
      • Oracle Apex
      • Python
    • Tags
    • Users
    • Badges & Points
    • About

    © 2020 OrclQA.Com. All Rights Reserved. Privacy Policy