Search code examples
htmlplsqloracle-apexoracle-apex-5oracle-apex-5.1

Oracle Apex PL/SQL Function Body Default value does not print correclty


I am currently using Oracle Apex 5.1 and I am having trouble getting my default value for a Text Area page item to print correctly. The default value is set to "PLSQL Function Body" and I am implementing HTML in the function body as well.

My code is as follows:

BEGIN
If :PAGE_ITEM = 'value' then
   htp.p('<b>Hello</b><br/>');
END IF;
END;

The word "Hello" is printed to the screen in bold, which is what I want. However, it is not printed to the screen in the correct place. This is supposed to be printed inside Text Area page item because it is set as the default value for the Text Area page item. Instead, the word is printed to the screen outside of the box in the top left corner of the page, and the Text Area page item is in the center of the page.

Does anyone have any ideas why this is happening?

Thank you in advance.


Solution

  • The idea of the function body is just to return the value to be used as default:

    if :PAGE_ITEM = 'value' then
       return 'Hello';
    end if;
    

    For the formatting, you have to resort to the formatting options of the text area item.