This topic contains 3 replies, has 0 voices, and was last updated by kphu 6 years, 7 months ago.

  • Author
    Posts
  • #21316 Score: 0

    kphu
    • Contributions: 0
    • Level 1

    I'm trying to develop an xml string value to produce a pdf file using nlapiXMLToPDF.

    I have a custom text area field, within the field is a string value that is typed with a carriage return example:

    "John Smith

    Jane Smith"

    When I get the field's value, it returns "John Smith Jane Smith". I want to preserve the carriage return.

    When I inspected the field's value in chrome web browser, I see "John Smith <br> Jane Smith". Using nlapiLogExecution after using nlapiGetFieldValue doesn't show the <br>.

    I tried using a character to denote the line break such as : and using a str.replace(/:/g, " <br />") for some reason why NS doesn't parse the replace i.e. in my nlapiLogExecution…the debug log still shows :

    Any suggestions?

    Thanks,

    Ken
    This is a cached copy. Click here to see the original post.

  • #21317 Score: 0

    dominicb
    • Contributions: 0
    • Level 1

    Have you tried replacing rn with <br/>?

  • #21318 Score: 0

    kphu
    • Contributions: 0
    • Level 1

    Not specifically rn but a myriad of various "carriage return" type of values.

  • #21319 Score: 0

    kphu
    • Contributions: 0
    • Level 1

    I got it to work. The is treated as an escape character so the correct syntax is .replace(/[r]/g, ' <br />);

You must be logged in to reply to this topic.