OnPageLoad event handler

Hi,
I created my first multi-page app today. Is there a way to have event handler for the page load?
I have a global variable which stores several app states to for example enable/disable "next page" buttons. This works great, but if I have the URL to a certain page, I can just go to that page without having the correct state. My idea was to check the variable state on page load, and if it fails, goto the page that initializes the state.

I am currently using stepped containers to simulate multi-page and there I can just check when clicking the button what "page" I am on and check the variable accordingly.

Hope this is clear enough :slight_smile:
Cheers
Dominik

I found a solution for the problem.

  1. Create an empty SQL query
  2. Make sure the query is set to "Automatic"
    image
  3. Create a JS query which has the functionality you need on page load
  4. Set the JS query in the event handler:
    image

I made the scriptOnPageLoad global so it can be run on every page. The SQL query needs to be on each page, except your landing page, or you will run in a endless circle :slight_smile:

2 Likes