Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Change Page Item Required property on the fly using JQuery

OraDev16Dec 2 2018 — edited Dec 3 2018

Hi All,

I'm using Apex 5.1. Depending upon the value of another item; i want to change the required property of a text item. By default, P2_ITEM_2 should be a required field except when the value of P2_ITEM_1 is A. So far I've tried the following -

**    For P2_ITEM_2, Set the Value Required property = Yes. and wrote the following as Dynamic Action- chnage event-js :

if($v("P2_ITEM_1") == 'A'){

$("#P2_ITEM_2").prop('required',false);

}else{ // though else part is not required I guess

$("#P2_ITEM_2").prop('required',true);

}

Also tried with  - $("#P2_ITEM_2").prop('aria-required',false); -- Didn't work as I've checked with $('[required]').

** Other possibilities:

(1) Field template : Required. (Can't do it because of some restrictions.)

(2) Be default set Value Required property of P2_ITEM_2 to No. then do NOT NULL validations. (Can't do it either).

So, tried with JQuery; but could't make it work. Any help will be highly appreciated.

Thanx.

This post has been answered by Scott Wesley on Dec 3 2018
Jump to Answer
Comments
Post Details
Added on Dec 2 2018
2 comments
494 views