locked
how to add carriage return when set field's value action rule RRS feed

  • Question

  • I am create a form, when user submit the form, there will be a line automatically added to the form text field like this:

    concat(txtSignatures, "<br>", " submitted by ", string(userName()), " at ", string(now()))

    such as "<br>" will work if it is html, or chr(13)+chr(10) or "\n" or something that can work?

    Thursday, April 21, 2011 2:24 PM

Answers

  • Hi George,

    The external XML datasource trick http://blogs.msdn.com/b/infopath/archive/2005/03/04/385577.aspx will work and let you insert line breaks.

     

    In InfoPath, you need to use the Textbox control, and enable multi-line.

    If you publish to web, it will use a TextArea element, which supports the line break.

    You can set the textbox to read-only if you want to use it like a label.


    jliu - johnliu.net - sharepointgurus.net
    • Marked as answer by George Zhou Monday, April 25, 2011 4:26 PM
    Friday, April 22, 2011 11:19 AM

All replies

  • Hi George,

    Did you try it?

    If you wanted to show it in page, I think the "\n" should not work.


    Microsoft Online Community Support
    Friday, April 22, 2011 8:51 AM
  • Hi George,

    The external XML datasource trick http://blogs.msdn.com/b/infopath/archive/2005/03/04/385577.aspx will work and let you insert line breaks.

     

    In InfoPath, you need to use the Textbox control, and enable multi-line.

    If you publish to web, it will use a TextArea element, which supports the line break.

    You can set the textbox to read-only if you want to use it like a label.


    jliu - johnliu.net - sharepointgurus.net
    • Marked as answer by George Zhou Monday, April 25, 2011 4:26 PM
    Friday, April 22, 2011 11:19 AM
  • Thanks John, it works.

    To Kefang: yes, I tried, but it didn't work. The url provided by John Liu works.

    Monday, April 25, 2011 4:28 PM
  • Hi John,

     

    Please help me, what do you mean by: "If you publish to web, it will use a TextArea element, which supports the line break."?

    Adding the xml secondary data source having the code below, doesn't work on web based form.

    <?xml version="1.0" encoding="UTF-8"?>
    <characters
        cr="&#xD;"
        lf="&#xA;"
        crlf="&#xD;&#xA;"
    />

    What Im trying to do is replace a page break inside a multitext box to a symbol (i.e. #), but when publish in Sharepoint, the blank spaces are replaced instead of carriage returns.

     

    Wednesday, October 12, 2011 2:31 AM
  • Just tested this again and all seems to be in order.

    http://johnliu.net/blog/2011/10/12/infopath-an-example-of-using-an-xml-file-for-special-charact.html


    jliu - johnliu.net - sharepointgurus.net
    Wednesday, October 12, 2011 4:58 AM
  • Hi,

     This doesn't appear to work in a Rich Text field with InfoPath 2010...
     Is there something I am missing?
      Thx,
        Barry

    Friday, October 26, 2012 4:53 PM