Skip to Main Content
Feature Request FR-4882
Product Area APIs
Status ROADMAP

6 Voters

Add setRequired to item interface

eric.olson Public
· May 7 2026

Idea Summary
The Javascript item interface should have a way to toggle whether an item is required. 

Use Case
Occasionally the value of one item determines if another item is required or optional. For example, if Beverage=Beer, the Customer Age field may become required. I can add post-submit validations for this, but there's no approved way to change the required appearance of the item. Right now, I just toggle the is-required class on the appropriate container.

Preferred Solution (Optional)
I would add apex.item.setRequired(boolean). There are already enable(), disable(), show(), hide() functions, so adding require() would also work, I just can't think of a good verb for “not required”. Unrequire?

This is currently on the roadmap for a future release of Oracle APEX.

Comments

Comments

  • abraham.olsen dk OP 4 months ago

    In this example, first I calculate a “YES/NO” and save it in some hidden item. It can be done in other ways, but illustrates.
     

    Then, use jQuery to change P1_ITEM.

    let vRequired=apex.item( "P1_ITEM_REQUIRED").getValue();
    if (vRequired === "YES"){
     $("#P1_ITEM").prop('required',true);
     $('#P1_ITEM_CONTAINER').addClass("is-required");
    } else {
     $('#P1_ITEM_CONTAINER').removeClass("is-required");
     $("#P1_ITEM").prop('required',false);
    }

    Save a function in your workspace files and reuse it if needed.

  • mswvette OP 3 months ago

    Depending on the default or field required indicator, you may need something like the following also:

    $("#P21_NOTE_error_placeholder").append("<div class='t-Form-itemRequired' aria-hidden='true'>Required</div>");