Add behavior whenever page is shown


Is there a good way to trigger a behavior every time a page is shown? I want to reset a form each time a user visits the page, even if the page is not refreshed.



You can create an Action under ui/content/js/customCode/Action/ that extends C3.action.Action, e.g. MyAction.js:

C3.define('C3.action.MyAction', {
  extend: 'C3.action.Action',
  config: {},
  dispatch: function (page, e) {
    . . . // do something

Then in your page (i.e. .c3ui file), attach the action to the page render event like this:

"pageRenderActions": [
    "type": "MyAction"
1 Like


Your action should be triggered by the show event instead of pageRenderAction pageRenderAction will only be triggered once when the page is first rendered.

Your action will listen on the page event if you do not specify the query field in your action

    "trigger": "show",
    "action": {
        "type": "ToggleComponentByPermission"
1 Like