oracle-databaseoracle-apexoracle-apex-19.1oracle-apex-18.2oracle-apex-19.2

How to make a linebreak in Display Only item in Oracle Apex?


I'm working on an app in Oracle Apex. I have a Display Only item built by using a Dynamic Action and Setting the value through the following PL/SQL Function Body

DECLARE
v_message varchar2(1000);
v_notification varchar2(10000);

BEGIN
FOR item IN
(SELECT * FROM NOTIFICATIONS)
LOOP
    v_message := item.notification_msg || chr(10) || chr(10);
    v_notification := v_notification || v_messsage;
END LOOP;
return v_notification;

END;

The problem is that the Line break characters are being ignored in the rendered page. Can you tell me how to display the item with the Line break characters rendered.

Let the Notifications table be like this

ID     NOTIFICATION_MSG
1      Last date for the application is 18th Dec.
2      Office closed from 25th dec to 1st Jan.

I want the rendered Display Only Item in the page to be

Last date for the application is 18th Dec.

Office closed from 25th dec to 1st Jan.

But it is rendered as

Last date for the application is 18th Dec.Office closed from 25th dec to 1st Jan.

Solution

  • As of chr(10) || chr(10): did you mean chr(13) || chr(10) instead?


    Anyway: include <br> as a line break, e.g.

    v_message := item.notification_msg || '<br>'
    

    Don't forget to set Escape special characters to "No" for that display item.