5
votes

I have a couple of dropdowns on my page, a hidden item and a button.

Whenever user changes the value of P1_DD1 or P1_DD2, I need to show the button if one of the following met:

1) If P1_HIDDEN='YES' and both P1_DD1 and P1_DD2 are not null

or

2) If P1_HIDDEN='NO' and P1_DD1 is not null

what is the best way to do this?

I originally added dynamic actions to both P1_DD1 and P1_DD2 on change and for P1_DD1 add set Client-side condition to Item IS NOT NULL and set the item to P1_DD1 and Server-side condition PL/SQL Ex[pression: :P1_HIDDEN='NO'

that works fine. The issue is with P1_DD2. I tried using similar logic - add client-side condition where P1_DD2 is not null and then add server-side condition PL/SQL Expression :P1_HIDDEN='YES' AND P1_DD1 IS NOT NULL but nothing happens. Trying to figure out why that is. Or, perhaps, there is a better way to do this?

2

2 Answers

10
votes

1 - Try to create a dynamic action when these items change (P1_HIDDEN, P1_DD1, P1_DD2).

2 - Client Side Condition >> Javascript Expression

((apex.item('P1_DD1').getValue() != '') &&
(apex.item('P1_DD2').getValue() != '') &&
(apex.item('P1_HIDDEN').getValue() == 'YES'))
||
((apex.item('P1_DD1').getValue() != '') &&
(apex.item('P1_HIDDEN').getValue() == 'NO'))

3 - True Action >> Show your button >> enable execute when page load

4 - False Action >> Hide your button >> enable execute when page load

4
votes

Literally copying what you've written, button's condition (a function that returns Boolean) would look like this:

return (
         (    :P1_HIDDEN = 'YES' 
          and :P1_DD1 is not null
          and :P1_DD2 is not null
         )
         or
         (    :P1_HIDDEN = 'NO'
          and :P1_DD1 is not null
         )
       );