Forum Stats

  • 3,839,012 Users
  • 2,262,438 Discussions
  • 7,900,836 Comments

Discussions

How to hide/close a region programmatically? (Apex 19.2)

John like many others
John like many others Member Posts: 116 Blue Ribbon
edited Jan 5, 2021 1:43PM in APEX Discussions

I try to close a region (inline dialog) programmatically. Either the documentation lacks or there is just no official function to do this. I know there is an internal function "close Region" that is working but I need it programmatically and as there is such a function it somehow must be accessible that way.

I also tried to set an ID on the region and to close it by JQuery:

  $('#MYREGION').hide(); -> Does only hide the body, header (with title) stays

  $('#MYREGION').css('display', 'none'); -> Keeps the whole dialog but empties the body

As ppl are already asking since 2012 for this I can't find it in the documentation of Apex 19.2

So how do I properly close an inline dialog programmatically?

Tagged:

Answers

  • jflack
    jflack Member Posts: 1,520 Bronze Trophy

    I don't have anything exactly like what you described, but I do have a region that displays only if a field has a certain value. The field is on a form, and is associated with a database column.

    What I did is set a server side condition on the region. Lots of choices for this, but one is "Item = Value". So, say the field in P72_MY_FIELD, and the rule is, "display the region only if P72_MY_FIELD contains 'Y'". The region shows if the condition is true, but does not show if the field contains anything but 'Y'. If I change the field from 'N' to 'Y' or from 'Y' to 'N' the region appears or disappears after I save the form - doesn't happen immediately because this is a server side condition.

  • John like many others
    John like many others Member Posts: 116 Blue Ribbon

    Thank you for your answer! I have a kinda similar situation but it's server related, not client related. I couldn't make it work as the server conditions are like bigger/smaller/equal than an item. I don't need to compare with a client item...

    Concrete case:

    If no (error) message comes back from the server then close the dialog window.

    In between I've found this in the Internet but not yet tested out:

    closeModal('MYDIALOG');

  • John like many others
    John like many others Member Posts: 116 Blue Ribbon

    Just tried it, it works like a charm!

    closeModal('MYDIALOG');