event()
Last updated 19/01/2026
Definition
The event() is a function on the
FormPage
object
thet returns the ID of the event that caused the form logic to run, such as OnLeaving
.
Examples
The following functions demonstrate how you can use the
event()
function on the FormPage
object.
Log which event triggered the form page
This code reads the event that caused the form logic to execute and logs the event ID to the Five Inspector.
Read the event that caused the form page logic to execute
const formPage = five.sender();
// Read the event that triggered this page's logic
const eventID = formPage.event():
five.log("FormPage logic triggered by:", eventID);
Run code when leaving the form page
This code runs when the tab looses focus and another tab gains the focus and logs the page caption to the Five Inspector.
Executes code when switching tabs
const page = five.sender();
if (page.event() === "OnLeaving") {
five.log("User is leaving the form page:", page.getCaption());
}