8.3.5.6 Making Almost Any Element Conditional
Add a Server-side Condition to almost any element in your APEX app to control whether APEX renders or runs it.
After configuring this rule on a component or page element, the APEX engine includes or executes it only when the test evaluates to true. Choose a declarative option, a PL/SQL expression, a Boolean returned by a PL/SQL function body, or a SQL statement that returns a row. You can apply the check to many elements, including regions, page items, columns, buttons, validations, computations, processes, and branches.
The When Button Pressed property of validations, processes, and branches
limits its execution to one button on the page. To run the element for multiple
buttons, use the declarative condition Request is contained in value and provide
a value that includes a delimited list of button names (e.g.
SAVE,UPDATE,INCREMENT).
This technique works because when a button named SOME_BUTTON
triggers a page submit, the APEX engine sets the value of the REQUEST substitution string to the name
of the button. Since you can reference substitution strings as bind variables in SQL or
PL/SQL, you can also express this multiple buttons condition using a PL/SQL expression
like:
:REQUEST in ('SAVE','UPDATE','INCREMENT')Tip:
Use the :REQUEST expression with an IN clause when
a longer name of a page button (e.g. SAVE_ADDRESS) includes the
shorter name of another button (e.g. SAVE). This avoids
unintentionally running logic when the SAVE button is pressed, that
happens to be part of the other buttons' names.
:REQUEST in ('SAVE_ADDRESS','SAVE_ASSIGNMENT') /* SAVE alone doesn't match */
For more information, see Available Conditions in Oracle APEX App Builder User’s Guide.
Parent topic: Render, Submit, Branch, Repeat