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
Event: Change
Selection Type: Item(s)
Item(s):
P1_ITEM
Client-side Condition Type: Item = Value
Item:
P1_ITEM
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");