oracle-apex

APEX Oracle multiple messages using g_notification in the same page are overlayed


I'm working with APEX oracle 23. Is there any way to set to display independent message in the same page before rendering page?

I'm trying to display many separate messages in processes before header using apex_application.g_notification in the same page. They are defined in separate processes. But only the last message is displayed while others are overlayed by the last one.

Thanks for any help.


Solution

  • There are some limitations that you're running into. apex_application.g_notification is a scalar variable and can only contain a single message. Another option is to do it javascript on page load and fire off a single apex.message.showPageSuccess call per message but they all overlay so the user will not see the individual messages, only the last. Moreover, they all appear in the same location so even if they appear one after the other the user will still not be able to go back to see the first of x messages.

    Possible solution:

    Instead of using one of the message frameworks above, use a normal page region of type "Dynamic Content" with template "Alert" to show the messages on the page.

    Example:

    Process 1 pls/sql source:

    :P255_GLOBAL_NOTIFICATION := 'First Message';
    

    Process 2 pls/sql source:

    :P255_GLOBAL_NOTIFICATION := :P255_GLOBAL_NOTIFICATION ||':'||'Notification 2';
    

    etc...

    Dynamic content region source:

    declare
        l_result clob := '<h4>Messages:</h4>';
        l_messages_table apex_t_varchar2;
    begin
        l_messages_table := apex_string.split(:P255_GLOBAL_NOTIFICATION,':');
        l_result := l_result || '<ul>';
        FOR i IN 1 .. l_messages_table.COUNT LOOP
            l_result := l_result ||
                '<li>' || apex_escape.html( l_messages_table(i) ) || '</li> ';
        END LOOP;
    
        l_result := l_result || '</ul>';
        return l_result;
    end;
    

    This gives you something like this: enter image description here

    Add a "hide" button or icon to hide the region the region or hide with timeout in javascript to spice it up a bit.