Oracle APEX - Conditionally Required Items

Oracle APEX - Conditionally Required Items

Using the Universal Theme "Floating" item template

For example, let's say we have two items P1_ITEM and P1_CONDITIONAL_ITEM. P1_CONDITION_ITEM is made mandatory when P1_ITEM value = 'Y'

Create a Dynamic Action

  1. Event: Change

  2. Selection Type: Item(s)

  3. Item(s): P1_ITEM

  4. Client-side Condition Type: Item = Value

  5. Item: P1_ITEM

  6. Value: Y

Create a True Action: Execute JavaScript Code

// TRUE ACTION 
var item = $("#P1_CONDITIONAL_ITEM");
item.prop("required", true);
item.closest(".t-Form-fieldContainer").addClass("is-required");

Create a False Action: Execute JavaScript Code

// FALSE ACTION
var item = $("#P1_CONDITIONAL_ITEM");
item.prop("required", false);
item.closest(".t-Form-fieldContainer").removeClass("is-required");