during a migration of a project to Primefaces 10 I get a problem with the textareas (p:inputTextarea) - the newline characters are removed before saving and the text is shown on one line.
There is nothing special with my textarea:
<p:inputTextarea id="offercommentTextareaId"
styleClass="m-0 w-100" rows="10" autoResize="true"
counter="offerdataCounterTextId"
counterTemplate="#{components['org.primefaces.component.inputTextarea.counterTemplate']}"
maxlength="4000"
value="#{supplierOffer.offercomment}"
readonly="false"
disabled="false">
</p:inputTextarea>
I cannot find any solution for this problem.
Many thx in advance
Update 1:
- I have tried also with h:inputTextarea and I got the same result - the newlines are removed before/during validation and before submit;
- also with the CSS property "white-space: pre;" - same result;
- I removed all CSS files - THEME to none and my CSS files commented - same result;
- With ICEfaces 4 is working.
I am using in this migration Primefaces 10.0.3 with MyFaces 2.3 on IBM Liberty 21.0.0.6
Because it is working with ICEfaces 4 I think there is a bug in Primefaces and / or JQuery.
Update 2: After a deeper look into the problem finally I got to the root of it. The problem is given by using the 'enctype="multipart/form-data"' into the h:form. The newline character is used as a delimiter for getting the "parts" out of the textarea. Without this attribute everything is working just fine. On the other hand this attribute is needed for uploading files. This answer explains it better as I do: How to have a working Textarea and a fileUpload in one form
I still don't get it why it is working with ICEfaces 4 (v. 4.3 exactly). Right now I have to split it in 2 forms.