Previous
Previous
 
Next
Next

Creating a Dynamic Action

Creating a Dynamic Action involves specifying when the action will happen (with optional conditions), what action or actions are performed, and what elements are affected by the action.

To create a dynamic action:

  1. Navigate to the appropriate Page Definition. See "Accessing the Page Definition".

  2. Access the Create Dynamic Action Wizard:

    • Tree view - Under Page Rendering, locate Dynamic Actions. Right-click and select Create.

      You can also invoke the wizard by right-clicking on a specific page item or region that you want to be the trigger for the dynamic action. This makes definition faster because certain When values will be pre-filled

    • Component view - Under Page Rendering, scroll down to Dynamic Actions and click the Create icon.

  3. For Implementation, select one of the following dynamic action types and click Next.

    • Standard - Select this option to create simple actions that show, hide, enable and disable page elements when a page item's value changes.

    • Advanced - Select this option to create complex actions such as setting a value, adding a class and using a dynamic action plug-in. This option also allows the selection of different events that will trigger the dynamic action.

  4. For Identification, enter the following and click Next.

    • Name - Enter the name of the dynamic action.

    • Sequence - Enter the sequence of this component. The sequence determines the order of evaluation.

  5. For When, specify when the action is performed and click Next. Options on this page include:

    1. Event - Dynamic actions can be defined to fire based on events that happen on the page. There are three different categories of events that can be utilized, Browser events, Framework events and Component events. Here are the details of all the supported events, including the internal JavaScript event name in brackets:

      Browser Events

      • Change (change) - Fires when a control loses the input focus and its value has been modified since gaining focus. This is the default setting.

      • Click (click) - Fires when the pointing device button is clicked over the triggering element.

      • Double Click (dblclick) - Fires when the pointing device button is double clicked over the triggering element.

      • Get Focus (focusin) - Fires when the triggering element receives focus either via a pointing device or by tabbing into the element.

      • Key Down (keydown) - Fires when a key on the keyboard is pressed. Use this event when you want to capture special keystrokes such as arrow keys, after a key has been pressed.

      • Key Press (keypress) - Fires when a key on the keyboard is pressed resulting in text being entered. Use this event when you want to capture actual text entry.

      • Key Release (keyup) - Fires when a key on the keyboard is released. Use this event when you want to capture special keystrokes such as arrow keys, after a key has been released.

      • Lose Focus (focusout) - Fires when the triggering element loses focus either via the pointing device or by tabbing out of the element.

      • Mouse Button Press (mousedown) - Fires when the pointing device button is pressed over the triggering element.

      • Mouse Button Release (mouseup) - Fires when the pointing device button is released over the triggering element.

      • Mouse Enter (mouseenter) - Fires once when the pointing device is moved into the triggering element.

      • Mouse Leave (mouseleave) - Fires once when the pointing device is moved away from the triggering element.

      • Mouse Move (mousemove) - Fires when the pointing device is moved while it is over the triggering element.

      • Page Load (ready) – Fires when the page loads.

      • Page Unload (unload) - Fires when a page is unloaded.

      • Resize (resize) - Fires when the browser window is resized.

      • Resource Load (load) - When the triggering element is the window element (using a 'DOM Object' value of 'window' in the 'When' attributes) the event fires when the browser finishes loading all content within a document, including window, frames, objects and images. For other elements, it fires when the target element and all of its content has finished loading.

      • Scroll (scroll) - Fires when a scrollable triggering element is scrolled. This could be the browser window (using a 'DOM Object' value of 'window' in the 'When' attributes), scrollable frames or elements with the 'overflow' CSS property set to 'scroll' (or 'auto' when the element's explicit height is less than the height of its contents).

      • Select (select) - Fires when a user selects some text in a text field.

      Framework Events

      • After Refresh (apexafterrefresh) - Fires after the triggering element has been refreshed. The event is only valid for triggering elements that perform 'Partial Page Refresh' and fire this event, for example Interactive Reports, Classic Reports, and all item types with cascading LOV support. Plug-ins might support this event as well.

      • Before Page Submit (apexbeforepagesubmit) – Fires prior to a page being submitted.

      • Before Refresh (apexbeforerefresh) – Fires before the triggering element has been refreshed. The event is only valid for triggering elements that perform 'Partial Page Refresh' and fire this event, for example Interactive Reports, Classic Reports, and all item types with cascading LOV support. Plug-ins might support this event as well.

      Component Events

      These events will only be available when there is a component (either an item, region or dynamic action) available to your application that triggers a custom event. These events will appear in the following format Event name [Component Name], for example the Change Order event triggered by the Shuttle native item type will appear as Change Order [Shuttle]. In Application Express, these events are triggered from either native components shipped with plug-in components you have installed into your application.

      • Events triggered by native components:

        Change Order [Shuttle] (shuttlechangeorder) – Fires when the order of a value in the right hand select list is changed (either using Move Top, Move Up, Move Down or Move Bottom). There are currently no other events triggered by native components in Application Express.

      • Events triggered by plug-in components:

        These will be available when added to your current application and will be in the format Event name [Component Name]. For help related to events raised by plug-ins, please refer to help text on the plug-in configuration page, by navigating to Shared Components > Plug-ins > [plugin name] > Help Text, where the plug-in author may have included documentation.

    2. Selection Type - Select the type of page element that triggers the dynamic action. A corresponding name field displays to specify the name of the page element.


      Note:

      Only available if the event selected supports definition of a page element. Selecting any of the following events will hide this field: Page Load, Page Unload, Resize, Before Page Submit. All other event types show this field.

    3. Item(s), Region, DOM Object, or jQuery Selector - Specify the name of the page element as follows:

      • Item(s) - Enter or select one or more page item names that trigger the dynamic action. For multiple items, please separate page items with a comma.

      • Region - Select the region name that triggers the dynamic action. The region selected must use a region template that includes a container element with an ID attribute set to #REGION_STATIC_ID#. The dynamic action framework relies on this ID value to reference the region.

        The region can fire the event itself, such as in the case of Before Refresh or After Refresh events, or can be a container to catch events that fire on items or other elements in the region. Only the following subset of events support this: Change (change), Click (click), Double Click (dblclick), Get Focus (focus), Key Down (keydown), Key Press, Key Release (keyup), Lose Focus (blur), Mouse Button Press (mousedown), Mouse Button Release (mouseup), Mouse Move (mousemove).

      • DOM Object - Enter either the Document Object Model (DOM) object or the ID of a DOM object that triggers the dynamic action.

      • jQuery Selector - Enter the jQuery selector syntax to return one or more page elements that trigger the dynamic action.

    4. Condition - To conditionalize the trigger, make a selection from the Condition Type list and enter text in the Value field. Based on whether this condition is met, it is possible to define both True (when it is met) and False (when it is not) actions. If No Condition is specified, only True actions will fire. For further information, see the item level help.

  6. Specify the action that is performed when the previously specified event occurs and conditions are satisfied, then click Next.

    • For True/False Actions (Standard), specify the True Action:

      • Show - The item displays when the event is true or No Condition is specified.

      • Hide - The item does not display when the event is true or No Condition is specified.

      • Enable - The item is enabled when the event is true or No Condition is specified.

      • Disable - Disables the affected elements. By disabling the affected elements, the page item will be non-editable and does not retain the item's value when the page is submitted.

      • Create Opposite False Action - For the selected true action above, create an opposite action to occur when the event is false. The Standard branch of the wizard allows selection of either Show, Hide, Enable or Disable actions for the True Action and provides the facility to create the logical opposite of this. For example, if Show' is selected for the True Action, checking the Create Opposite False Action checkbox would also create a Hide false action.


        Note:

        Create Opposite False Action only available if a Condition has been specified.

    • For True Actions (Advanced only) - The Advanced branch of the wizard allows selection of all actions and allows selection of different True and False Actions. For both the True Action and False Action pages you specify. Depending on the selected action, additional options display. Use these options to specify additional settings and values required to perform the action.

      Component

      • Clear - Clears the affected elements.

      • Disable - Disables the affected elements. By disabling the affected elements, the page item will be non-editable and does not retain the item's value when the page is submitted.

      • Enable - Enables the affected elements.

      • Hide - Hides the affected elements. Also has the option to Hide all page items on the same line.

      • Refresh - Triggers a refresh of the affected elements. Note that not all elements support a refresh, you can use it for interactive reports, classic reports and all item types with cascading LOV support. Plug-ins might support this action as well.

      • Set Focus - Sets the focus to the affected elements. This will default to the first of the affected elements if there are multiple. This can be especially useful when used in conjunction with the Show and Enable actions to take the user straight to the appropriate item.

      • Set Value - Sets the value of the affected elements. This supports the following Set Types: Static Assignment, JavaScript Expression, SQL Statement, PL/SQL Expression, PL/SQL Function Body.

      • Show - Shows the affected elements. Also has the option to Show all the page items on the same line.

      Execute

      • Execute JavaScript Code - Allows you to define or call custom, page specific JavaScript code to use within the dynamic action framework. If you are defining JavaScript code that is specific to just one page, you can also make use of the new page level attribute 'Function and Global Variable Declaration' to define this. Functions and variables defined here can subsequently be referenced from this action.

      • Execute PL/SQL Code - Executes some PL/SQL code on the server. If an error occurs during execution, the user will be alerted.

      Notification

      • Alert - Displays an Alert.

      • Confirm - Displays a confirmation dialog. If the user chooses Cancel then the proceeding actions are not executed and the current event is canceled.

      Style

      • Add Class - Adds 1 or more CSS classes to the affected elements.

      • Confirm - Displays a confirmation dialog. If the user chooses Cancel then the proceeding actions are not executed and the current event is canceled.

      Miscellaneaous

      • Cancel Event - Cancels subsequent dynamic actions or events from firing, based on certain conditions. This could be useful in the following situations:

        If you have multiple dynamic actions on a page that are based on the same event (such as Click) and they refer to the same element on the page, the Cancel Event action can be used to prevent subsequent dynamic actions from firing, conditionally based on it's When Condition.

        If a dynamic action has many true or false actions, Cancel Event can be used to halt subsequent actions from being processed. Currently this has limited value as it is not possible to define a dynamic action's actions to fire conditionally, so this would just always prevent subsequent actions being processed, which could be useful in debugging.

        Used to cancel page submission, when used in conjunction with the Before Page Submit event of dynamic actions. For example, if you define a dynamic action that fires on the Before Page Submit even, and for the Condition define JavaScript Expression, and in the Value' some expression such as $v('P2_ENAME') == 'DO NOT SUBMIT'. Then, if you define a True Action that uses the Cancel Event action, the page will not be submitted when the ENAME field is equal to DO NOT SUBMIT.

      • Submit Page - Submits the page.

      Plug-ins

      • my_plugin_action[Plug-in] - Depending on your application configuration, you may also have additional plug-in dynamic actions available here. These will be displayed as 'my_plugin_action [Plug-in]'. Plug-in dynamic actions are installed within the application's shared components. The plug-in developer will have assigned an appropriate category for the action (Component, Execute and so forth).

    • Fire On Page Load (Advanced only) - Select this option to also trigger this action when the page loads. This may or may not be checked by default, depending on the type of Action selected.

  7. For Affected Elements (available only for actions that support affected elements), specify the elements affected by this dynamic action and how they are affected then click Next.

    The final step in creating the dynamic action is different depending on whether the action you have selected supports selection of affected elements. Some actions, such as Submit Page, do not required affected elements to be selected. Other actions, such as Show, do. If the action selected does not support selection of affected elements, the last page will just be a Confirm page where you can review details of the dynamic action. If the action selected does support selection of affected elements, options on this page include:

    • Selection Type - Select the type of page element that is affected by the dynamic action. Depending on the selected type, additional options display. Use these options to specify additional settings and values required to specify how the element is affected.

    • Item(s), Region, DOM Object, or jQuery Selector - Specify the name of the page element as follows:

      • Item(s) - Select the item name that is affected by the dynamic action.

      • Region - Enter or select the region name that is affected by the dynamic action. The region selected must use a region template that includes a container element with an ID attribute set to #REGION_STATIC_ID#. The dynamic action framework relies on this ID value in order to reference the region.

      • DOM Object - Enter either the Document Object Model (DOM) object or the ID of a DOM object that is affected by the dynamic action.

      • jQuery Selector - Enter the jQuery selector syntax to return one or more page elements that is affected by the dynamic action.

  8. Click Create.