Textarea Field - How to save line breaks

Hi! I am using a function to create/update a new record. How to create line breaks in textarea field?

$record = new Product();
$record->description = 'Parameter 1: Lorem ipsum<br>Parameter 2: Lorem ipsum';

Saved record looks like this:

Hi,
have you tried a simple

\n

Yes, unfortunately the effect is the same
image

How I do that is by inserting the line returning inside the code itself and it works fine with a SHIFT+RETURN key combination

$record->description = 'Parameter 1: Lorem ipsum
Parameter 2: Lorem ipsum';

2 Likes

\n should work.

summary:
        label: ..
        size: huge
        span: auto
        type: textarea
$model->summary = "first line \nsecond line";
$model->save();

image

1 Like

Thank you, your solution works!