Home > OS >  Why button disappeared after giving server-side conditions as PL/SQL expression in Oracle APEX?
Why button disappeared after giving server-side conditions as PL/SQL expression in Oracle APEX?

Time:04-06

I need to check if two of the page item values are equal and only then redirect to another page in my Oracle Apex application. I chose Server-side Condition like this:

enter image description here

But why did my button disappear from the page?

CodePudding user response:

A server side condition is evaluated at page rendering time. It does not take into account and changes in page item values once the page is rendered. In the case of your button, this means that the button is only rendered when the condition :P2_QR_RESULT = :P2_TAG_IDENTIFIER yields true when the page is rendered. The button doesn't "disappear" it just never "appeared".

It is unclear from your question what the business flow is. Here is one possible solution, but depending on your case there might be better ones. If the button needs to dynamically appear/disappear (or be enabled/disabled - this is more intuitive for a user) then the way to do this is by setting a Dynamic Action on each of the 2 page items. Evaluate the value of both page items and if there are equal, enable/show the button else hide/disable the button. Make sure the dynamic actions fire on page load.

CodePudding user response:

That's OK. Apparently, values of P2_QR_RESULT and P2_TAG_IDENTIFIERS aren't equal so page didn't render the button so user's can't possibly go to another page. That's what you wanted, right?

Because, if values were equal, you'd see the button, you could click to it and it would take you to another page.


If you want to see the button but make it "do nothing" once it is pressed, then

  • let it submit the page
  • create a branch which will take you to the target page
  • set its (branch's) server-side condition to
    • run when that button is pressed

    • type: function body:

      return :P2_QR_RESULT = :P2_TAG_IDENTIFIER;
      

Note that this might act "funny" for users; they will see the button, they will press it, and nothing will happen. Make sure to let them know why button won't do anything.

  • Related