On form loaded event

I need to disable the hamburger until a form as fully loaded.

How do I do this for each form.

This only show when the first form loDS.

  $(window).bind("load", function() {
   alert('form loaded');
});

Cheers

Steve Warby

Disable it in the AppStudio Design screen - there is a disabled property.

Sub Main gets runs once the app is fully loaded. You can set disabled to false for your Hamburgers there.

The load event can’t be used for individual forms or controls. Instead, to trigger availability of the hamburger’s dropdown menu, I suggest

  1. creating a global variable allowMenu that allows or prevents the dropdown from displaying
  2. setting allowMenu to false on app start and each time you use ChangeForm()
  3. setting allowMenu to true whenever your data has loaded and you want the dropdown to display
  4. creating a global listener on the hamburger control to capture click events on it and then handling whether to display the dropdown or not

In global code:

var allowMenu = false;

$(Hamburger1).on("show.bs.dropdown", (e) => {
  if (allowMenu === false) {
    e.preventDefault();
  }  
})

Kind regards,
Doug

Thanks for the help Doug

Ref 3.

I load my data for each form at startup. I them use the hamburger to switch forms.
So there is no data loaded event to switch allowMen to true

Hence why I was hoping for a form loaded event.

Unless I’m missing something obvious.

Cheers

Steve Warby.

Indeed, there is no onload event for forms, but there is an onshow event. However, that is likely not what you’re looking for.

Controls display instantly when a form shows, so I’m assuming your issue is one of data not being fully displayed (loaded) for the newly shown form. The code I suggested should nicely prevent or allow the display of the hamburger dropdown menu, but is that what you need? If you’re using the hamburger to switch between forms, maybe what you need instead is for the dropdown menu to always show, but each menu item would be disabled or enabled depending on the status of the data.

In the end though, you would still need to segment the isLoaded status for each form’s data.

Kind regards,
Doug