Model-driven Power Apps can notify your code when certain events happen in the following parts of your apps.
- Form
- OnLoad – when form loads.
- OnSave – when data is saved.
- Tab
- TabStateChange – when a tab expands or collapses.
- Column
- OnChange – when data changes in the column and its control loses focus.
- IFrame –
- OnReadyStateComplete – when the content of IFrame is fully loaded.
Hints!
- TabStateChange is the best event to set the src property of an IFrame in a tab. If you otherwise do it in OnLoad event for a an IFrame that is in a collapsed tab, it will be overwritten when the tab expands!
- OnChange happens immediately for Yes/No buttons that are formatted to use checkbox or radio buttons.
- OnChange happens also when the data is changed on the server and the form refreshed (e.g. after a record is saved).
- You can also trigger OnChange by calling
attribute.fireOnChange
. - Make sure to read the official docs about OnChange events. They can be tricky.
- Try to always stick with these main events, but you can find all events that are available to you in JavaScript in here.
Leave a Reply