I needed to show a success message after ending a Dynamic Action and I wanted this message to be with the same format as success messages from page processes. Since this is not a standard feature of Oracle APEX, you can do the following trick if you’re using Universal Theme:
- Create a JavaScript function which replaces APEX_SUCCESS_MESSAGE region and makes it visible with a message parameter
- OPTIONAL: Create an APEX item to store your message (this is useful if you want to show dynamic messages)
- Call function created at step 1 via Dynamic Action passing the value of the item created at previous step
1) Add the following code at HTML Header section
1 2 3 4 5 6 |
<script> function show_success_message(p_message){ $('#APEX_SUCCESS_MESSAGE').append('<div class="t-Alert t-Alert--defaultIcons t-Alert--success t-Alert--horizontal t-Alert--page t-Alert--colorBG is-visible" id="t_Alert_Success" role="alert"> <div class="t-Alert-wrap"> <div class="t-Alert-icon"> <span class="t-Icon"></span> </div> <div class="t-Alert-content"> <div class="t-Alert-header"> <h2 class="t-Alert-title">'+apex.util.escapeHTML(p_message)+'</h2> </div> </div> <div class="t-Alert-buttons"> <button class="t-Button t-Button--noUI t-Button--icon t-Button--closeAlert" onclick="apex.jQuery(\'#t_Alert_Success\').remove();" type="button" title="Close Notification"><span class="t-Icon icon-close"></span></button> </div> </div>'); $('#APEX_SUCCESS_MESSAGE').removeClass('u-hidden'); } </script> |
2) Inform an APEX item with your message via Dynamic Action, for instance use “Set Value”:
3) Create a JavaScript dynamic action which calls our show_succes_message function:
1 |
show_success_message($v("P20_MESSAGE")); |
Likewise, you can create another JS function to inform APEX_ERROR_MESSAGE so that you can also show error messages.
Hope it helps!