0

I want to create conditional rendering in oracle apex.

Depending on what the user selects (Employee, Department(these are the displayed values)) for Page Item (P15_CHOICE),I want to display a different region

for the regions I have following SQL Expression in the server-side condition:

InStr(:P15_CHOICE, 'Employee') > 0

However it does not work, and I as well get no error Can someone help here?

user111
  • 137
  • 1
  • 15
  • What is the value of `P15_CHOICE` when the page renders? Assuming that the control is on the same page as the region you want to enable or disable, you could either modify the `P15_CHOICE` control so that changes cause the page to be submitted (assuming it is a select list, there is a Page Action on Selection setting for this) or you could set up dynamic actions that show and hide the region dynamically based on changes. The latter is generally going to give the more elegant user experience but generally involves a bit more code. – Justin Cave Apr 10 '21 at 11:01
  • Is your select even submitting the page? That is not the default so usually for this you would either need a 'Go' button OR make the select 'submit' page on change which should be an option somewhere in the item properties. – REW Apr 10 '21 at 17:25

1 Answers1

0

I assume you are displaying/hiding this region with a Server-Side Condition in the Apex Designer. This evaluates when the page is rendered, which means it uses the value of P15_CHOICE that's set in session state. When you are first generating your page, that's probably null.

Probably the easiest thing to do is change the P15_CHOICE item so it submits the page when the value is changed. This will cause the page to submit all the values to Apex, which will re-generate the page using the current values of these items.

Another option is to always generate the region, but hide it with a Page Load Dynamic Action, then use a Page Show Dynamic Action when the user selects a value.

eaolson
  • 14,717
  • 7
  • 43
  • 58
  • Thank you.I have used the page load dynamic action, which is far more interactive for the user. – user111 Apr 12 '21 at 07:56