This discussion is archived
3 Replies Latest reply: Jan 28, 2013 6:02 AM by Roel RSS

How to show error message on page #NOTIFICATION_MESSAGE#?

Krishna Vashistha Newbie
Currently Being Moderated
Hi,

Is it possible to show error message on a page, where apex substitutes #NOTIFICATION_MESSAGE# at page template, with a javascript call? My requirement is to report error messages which i get from ondemand process, these on-demand processes were called from my javascript code. If any error message is returned by on-demand process, as of now, I'm reporting the error message to user by javascript based alert dialog box, but it would much better if i could keep the error message reporting by my application in a consistent manner. So any suggestion please?

-Krishna
  • 1. Re: How to show error message on page #NOTIFICATION_MESSAGE#?
    Roel Oracle ACE Director
    Currently Being Moderated
    You can add a snippet of HTML (same as in your template) to your page when and error occurs. The error text can be stored in a Page 0 item (when necessary)

    function showError(){
    $('.notification').remove();
    $('#messages').append('<div class="notification" id="notification-message"><img src="/i/delete.gif" onclick="$x_Remove(\'notification-message\')" style="float:right;" class="remove-message" alt="">An error has occurred.<ul class="htmldbUlErr"><li>'+$v('P0_ERROR_TEXT')+'</li></ul></div>');
    }
  • 2. Re: How to show error message on page #NOTIFICATION_MESSAGE#?
    Krishna Vashistha Newbie
    Currently Being Moderated
    Hi Roel,

    Thanks, jumping in for help.
    I tried your given code, i found that the page html source doesnt has any element with a name '#messages'. As per my understanding, its the apex engine which checks for any error, if found it shows it by adding an element id '#messages', but here on my requirement its not the apex engine which has detected the error, its my functional logic which wants to report a message. On a normal and error free page condition, we usually dont find '#message' element. I'm curious on how apex inbuilt engine is reporting an error to a page?
  • 3. Re: How to show error message on page #NOTIFICATION_MESSAGE#?
    Roel Oracle ACE Director
    Currently Being Moderated
    This #messages refers to an element defined in the Page Template.

    In our environment it is the first line of the Body :
    <div id="messages">#SUCCESS_MESSAGE##NOTIFICATION_MESSAGE##GLOBAL_NOTIFICATION#</div>

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points