Form event on open

I am looking for an event fired every time a form is opened.

I looked here:

And I thought onload was the way to go, but it fires only on first load of each document.
So for example:

  • Open Doc-1 → FIRE
  • Open Doc-2 → FIRE
  • Open Doc-1 → WON’T FIRE

combine onload and refresh like below

  1. define custom form_open function
  2. in onload, call form_open and set frm.onloaded (internal tracking)
  3. in refresh, if not frm.onloaded call form_open
1 Like

Thanks @szufisher, but this won’t work as the same frm instance is re-used for every different document opened. So setting frm.onloaded=true on onload event, will remains true for every other documents opened.


  • Open DOC-1
    • onload event fires
    • set frm.onloaded=true
  • Open DOC-2
    • onload event fires
    • set frm.onloaded=true
  • Open DOC-1
    • onload event DOESN’T fire
    • within refresh event, frm.onloaded is already true because it keeps value from previous form open

I’ve found this ‘show’ event that we can hook on the page like this:

But frm.doc points to previous doc, not the one about to be shown…

This framework is driving me crazy !