Skip to main content

Binding to events (6734+)

The platform sends out events when a couple of events are performed. Code can be written to bind to these.

Events

  • hide-field, triggered when the platform hides a field (dependency or hideField-function)
  • show-field, triggered when the platform shows a field (dependency or showField-function)

How to bind

$("tr").bind("hide-field", function(e) {
    // Do stuff..
})

 

Custom events

TS implements a couple of custom events, that you can bind your headers and scripts to.

Preparing Submit

When the platform i preparing to submit the form, first it fires the event TS_PrepareSubmitForm on #TempusServaPage.
You can bind to this event like this:

$('#TempusServaPage').on('TS_PrepareSubmitForm', () => {
  console.log('Preparing submit!')
})

Dynamic reload of fields

If the policy reloadParentFieldsOnClose is enabled (as of version 11355) when a child-record is submittet, the parent record i no longer reloaded, instead a reload is performed in the background, and the child-fields are replaced.
Once this task is performed the platform fires the event TS_RefreshFieldsFromServer on #TempusServaPage.
You can bind to this event like this:

$('#TempusServaPage').on('TS_RefreshFieldsFromServer', () => {
  console.log('child was submitted!')
})