APIs & Integrations

Not applicable

Forms api submission does not honour line breaks

Hi, I am having trouble with the forms api to honour the line breaks.

This is an example:

~ $ curl -X POST \
      https://forms.hubspot.com/uploads/form/v2/XXXXXX/XXXXX-XXXXXXXX\
      -H 'content-type: application/x-www-form-urlencoded' \
      -d 'livechat_transcript=Agent%3A%20Hello%0AVisitor%3A%20Hi%0AAgent%3A%20Would%20you%20like%20some%20help%0AVisitor%3A%20No%20thanks&email=example%40email.com'

Have in mind that livechat_transcript is a multi-line property.
The submission creates an entry succesfully, but livechat transcript’s line breaks get removed!

What am I missing here?

0 Upvotes
3 Replies 3
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Forms api submission does not honour line breaks

Hi @mariosant,

Line breaks will not appear in the raw form submission, but will be preserved on the contact record itself. For example, here is a test form submission that I did this morning:

!

When viewed from the form submissions page, the text appears to have had the line breaks removed. However from the contact record, we can see that the line breaks are preserved:

Does this match what you’re seeing? Can you check the property on the contact record as well as in the form submission page?

0 Upvotes
Not applicable

Forms api submission does not honour line breaks

Thank you @Darek_Gervais! Will check this with the colleagues right away.

0 Upvotes
BAM5
Participant

Forms api submission does not honour line breaks

Any plans to fix this? As of a few days ago all the line breaks were removed from the text. Today I see that each line is now wrapped in a div tag when viewed from the view submissions page. However this doesn't preserve multiple line breaks. Instead of wrapping each line in a div, replace each newline character with a <br/> tag.

 

This can be accomplished in javascript with

previewText.replace(/\r?\n/g, '<br/>');
0 Upvotes