APEX-AT-WORK no image

APEX textareas with line breaks (CRLF)

Von Tobias Arnhold 11.03.2008
Sometimes you could come in the situation to create automatic generated text. To show it in APEX you could use textarea items. In case you need to put up line breaks there are two ways I know about:

1. Use a PL/SQL process:

DECLARE
-- create line break variable
CRLF VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
BEGIN
-- set text
:P26_TEXTAREA := :P26_Text1 || CRLF || :P26_Text2;
END;

2. Use Javascript

function SET_MESSAGE_TEXT()
{
if ($x('P26_TEXTAREA_ACTION').value == 1){
$x('P26_TEXTAREA').value = 'Hello \n . next line';
}else {
$x('P26_TEXTAREA').value = '';
}}

More information:
Example application
APEX Forum entry

Thanks to Dimitri and Arie for the support when I had this problem the first time.

Post Tags: