cancel
Showing results for 
Search instead for 
Did you mean: 

Handling Multi-line text in blox

bbontrager
7 - Data Storage
7 - Data Storage

Noticed an odd behavior with multi-line text inputs in blox.

If I define a text input as multiline...

 

{
"type": "Input.Text",
"id": "data.Parameters.NOTES",
"defaultValue": "",
"isMultiline": true,
"rows": "5",
"value": "{panel:NOTES}"
},
 
I can enter text with new lines as expected
bbontrager_0-1715879039495.png

We save this to a database by an API, then retrieve it.  If we just display the data, newlines are preserved (bottom of the picture below) BUT the same panel value in the text input is rendered with the <br/> tag embedded in it (top of the picture below)

{
"type": "TextBlock",
"id": "",
"class": "",
"spacing": "small",
"weight": "normal",
"widget": "90%",
"text": "{panel:NOTES}"
},
 
bbontrager_1-1715879179468.png

 

 

Embedding the <BR/> tag makes sense when the value is being shown as a Text Block, but not when it is placed into a Text Input.

Is there a blox setting that will allow the Text Input to render as expected, or do I need to hack around it with javascript in the widget?

 
2 REPLIES 2

ILLIA
Sisense Team Member
Sisense Team Member

Hello @bbontrager 

This behaviour is happening because text block can render HTML elements (it is separated as HTML block in components but it is still the same block)
As a solution, you might want to replace <br/> with \n, this way text area will be able to read new line and show data as expected. 
Please inform if you have any questions. 

Best regards,

ILLIA

DRay
Community Team Member
Community Team Member

Hello @bbontrager ,

I wanted to follow up to see if the solution offered by @ILLIA worked for you.

If so, please click the 'Accept as Solution' button so other users with the same questions can find the answer faster. If not, please let us know so that we can continue to help.

Thank you.

David Raynor (DRay)
Community Toolbox

Recommended links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]