This discussion is archived
6 Replies Latest reply: Dec 6, 2012 9:39 AM by JackieW RSS

APEX Notification Message Box

JackieW Newbie
Currently Being Moderated
I'm using APEX 4.1.0.00.32 with Theme 22. My APEX application uses some legacy PL/SQL which tends to raise lengthy application error messages. These messages appear in the notification message box on the APEX page (#NOTIFICATION-MESSAGE#), but these messages are not formatted the way I would like.

If there is a chr(9) or a html break tag in the message raised by the PL/SQL, the line breaks are stripped out at some point before they get to the APEX page. I really need line breaks in these messages.

And there seems to be a limit to the number of characters displayed. I've looked all through the css and I don't see where the height of the box is limited in the css. The message must be truncated before the page gets rendered.

I am migrating from Oracle Designer, and these messages appear full length and with line breaks using Oracle Designer. My users would like to see this in APEX.
Thanks,
Jackie

Edited by: JackieW on Aug 16, 2012 11:51 AM
  • 1. Re: APEX Notification Message Box
    fac586 Guru
    Currently Being Moderated
    JackieW wrote:
    I'm using APEX 4.1.0.00.32 with Theme 22. My APEX application uses some legacy PL/SQL which tends to raise lengthy application error messages.
    How lengthy? How are the error messages raised and processed?
    These messages appear in the notification message box on the APEX page (#NOTIFICATION-MESSAGE#), but these messages are not formatted the way I would like.

    If there is a chr(9) or a html break tag in the message raised by the PL/SQL, the line breaks are stripped out at some point before they get to the APEX page. I really need line breaks in these messages.
    A suitable <tt>white-space</tt> CSS setting on the notification box should handle this:
    #notification-message {
      white-space: pre-wrap;
    }
    And there seems to be a limit to the number of characters displayed. I've looked all through the css and I don't see where the height of the box is limited in the css. The message must be truncated before the page gets rendered.
    I'm seeing neither APEX/SQL message truncation (from a maxed-out 4000-character Process Error Message) nor any CSS height restriction. It would help if you could illustrate this with an example on apex.oracle.com.
  • 2. Re: APEX Notification Message Box
    JackieW Newbie
    Currently Being Moderated
    My latest example message is 960 characters long. The error messages are raised using
     raise_application_error(-20999, LookErrors); 
    This is part of a PL/SQL function called by an APEX item validation. LookErrors is a function returning a varchar2. The varchar2 can have any kind of line breaks I choose. I've been experimenting with different kinds of line breaks including
    chr(10)
    chr(10) || chr(13)
    <br />
    </li><li>
    This is an example of what I see on the APEX screen:
    1 error has occurred
    ORA-20999: TAPI-0:BR_PRJ0018 - Before a Project can be changed to Proposed, it must have
    a Task with an Annual Statement of Work - BR_PRJ0018 </li><li>  TAPI-0:BR_PRJ0016 - Before
    Project Status can be changed to Proposed, a location record must be entered for the project or
    an associated task - BR_PRJ0016</li><li> TAPI-0:BR_PRJ0015b - To change Project Status to
    Proposed, all Tasks must have an Objectives narrative - BR_PRJ0015b</li><li> TAPI
    -0:BR_PRJ0015a - To change Project 
    Only the first 490 characters are displayed, so that seems to be my limit for now. The html tags appear as plain text. If I use chr(10) instead, I just see a space.

    I tried the css in the html header of the page
    <style type="text/css">
    #notification-message, li.htmldbulerr
    {
      white-space: pre-wrap;
    }
    </style>
    It doesn't make a difference in what I see.

    The "View Source" from IE is like this:
    <div id="messages"><div class="notification" id="notification-message">
      <img src="/i/delete.gif" onclick="$x_Remove('notification-message')"  style="float:right;" class="remove-message" alt="" />1 error has occurred<ul class="htmldbUlErr"><li>ORA-20999: TAPI-0:BR_PRJ0018 - Before a Project can be changed to Proposed, it must have a Task with an Annual Statement of Work - BR_PRJ0018&lt;/li&gt;&lt;li&gt;           TAPI-0:BR_PRJ0016 - Before Project Status can be changed to Proposed, a location record must be entered for the project or an associated task - BR_PRJ0016&lt;/li&gt;&lt;li&gt;           TAPI-0:BR_PRJ0015b - To change Project Status to Proposed, all Tasks must have an Objectives narrative - BR_PRJ0015b&lt;/li&gt;&lt;li&gt;           TAPI-0:BR_PRJ0015a - To change Project </li></ul>
    </div></div>
    The relevant css is this:
    #notification-message {
         margin: 10px auto;
         font: bold 14px/20px Arial, sans-serif;
         text-shadow: 0 1px 0 rgba(255,255,255,0.5);
         color: #EA0000;
         background: url(../images/sReportBG.png) 0 -200px #DADADA repeat-x;
         width: 560px;
         padding: 10px;
         border: 1px solid #999;
         border: 1px solid rgba(0,0,0,.4);
         -moz-border-radius: 6px;
         -webkit-border-radius: 6px;
         -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.2);
         -moz-box-shadow: 0 1px 1px rgba(0,0,0,.2);
    }
    ul.htmldbUlErr {
         font-weight: normal;
         padding: 5px 0 0 10px;
         margin: 0 0 0 10px;
         }
         ul.htmldbUlErr li {
         font: normal 12px/20px Arial, sans-serif;
         color: #222;
         }
    Other than that, there's not much in the APEX page.
    Jackie

    Edited by: JackieW on Aug 17, 2012 8:33 AM
  • 3. Re: APEX Notification Message Box
    JackieW Newbie
    Currently Being Moderated
     
  • 4. Re: APEX Notification Message Box
    JackieW Newbie
    Currently Being Moderated
    Still working on this.

    When using
    <br />
    as my line break, it is like this in the view source:
    ent of Work - BR_PRJ0018 & lt;br /& gt;           TAPI-0:BR_PR
    (I put spaces after each & so you can see that it is the characters for escaping the angle brackets)

    As you can see APEX escapes the angle brackets when it renders the page. I can't imagine a css that can fix that. I wish I could tell APEX to please not escape the html tags that I put into my error message.

    Also only half of the almost 1000 characters in the message are rendered in the view source page. Again, css can't fix that. If my understanding is correct, the css can only work on the text that APEX returns to the page. Of course if my understanding was correct, I might not have this problem.

    By the way, here is the subtemplate for notification:
    <div class="notification" id="notification-message">
      <img src="#IMAGE_PREFIX#delete.gif" onclick="$x_Remove('notification-message')"  style="float:right;" class="remove-message" alt="" />#MESSAGE#
    </div>
    I would be happy to alter the template, if I could think of an alteration that would help.

    Edited by: JackieW on Aug 22, 2012 8:19 AM
  • 5. Re: APEX Notification Message Box
    JackieW Newbie
    Currently Being Moderated
    I've decided to give up on legacy method of appending these errors together with line breaks in between. I've broken the validations up into separate validations. This seems to work fine. APEX adds the breaks between the separate validations.
  • 6. Re: APEX Notification Message Box
    JackieW Newbie
    Currently Being Moderated
    The problem with line breaks eventually solved itself. As far as the message being cut off, I wasn't able to reproduce that in the public workspace, but it is no longer a problem

Legend

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