Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Text Area ignores /r on line breaks over REST connector

SA-64101

Summary



Sending data from a TextArea control using REST connector fails to respect '\r' for line breaks.

The application has two buttons, Submit and Save. Submit does a form submit. Save does a refresh section with an associated data transform. Both sends the value of a text area to a REST connector. If the value in the text area is multi-line, the behavior of the two actions is different.

For example, if the value is:

1
2
3

Submit sends '1\r\n2\r\n3' which is the desired behavior.

However, Save sends '1\n2\n3'.


Error Messages



Not Applicable.


Steps to Reproduce

  1. Create a TextArea control in a section
  2. Create a Save button for the TextArea control which calls a REST connector to send the data:
    {Request Message={"RHNote":"1\n2\n3","UpdatedBy":"pega"}}
  3. Configure post action to send the data through the REST connector on click of Submit:{Request Message={"RHNote":"1\r\n2\r\n3","UpdatedBy":"pega"}} 


Root Cause



The issue occurs due to the difference in the way browser encodes newline when using the encodeURIComponent browser API (%0A >> \n) and encoding the form data while form submitting (%0D%0A >> \r\n). When the refresh section is called, the post data is encoded using the encodeURIComponent API in the UI framework.


Resolution

Perform the following local-change:

Implement a post activity to add the desired '\r' characters where required.


 

Published September 13, 2018 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us