locked
Carriage return missing in webservice Lists.asmx RRS feed

  • Question

  • I am using the Lists.asmx webserive to retrieve data from a sharepoint multiline textbox.

    In the sharepoint textbox there is a carriage return to make a new line.

    The string that I get from the webserive doesn´t deliver the carriage return.

    How do I get the carriage return from the sharepoint textbox?
    Monday, June 8, 2009 11:19 AM

Answers

  • Hi,

    In WSS 3.0 / MOSS 2007 the built-in multiline textbox (Microsoft.SharePoint.WebControls.NoteField field control, Microsoft.SharePoint.SPFieldMultiLineText field type) is basically a rich text field with or without the ability to edit rich text. There is a method in the field (SetRichTextMode) that sets the control mode as:

    public enum SPRichTextMode
    {
        Compatible,
        FullHtml,
        HtmlAsXml
    }

    Corresponding to the UI setings:
    Specify the type of text to allow:
      Plain text  
      Rich text (Bold, italics, text alignment)
      Enhanced rich text (Rich text with pictures, tables, and hyperlinks)

    Now the question is what type your multiline textbox is?

    If you are in HTML mode, the content is stored as HTML, for examle, separate lines are in <DIV></DIV> tags.

    The problem you reported is with the plain text mode, where I found the behaviour you described: the line breaks are replaced with spaces.

    Very interesting!

    Peter
    Monday, June 8, 2009 12:41 PM

All replies

  • Hi,

    In WSS 3.0 / MOSS 2007 the built-in multiline textbox (Microsoft.SharePoint.WebControls.NoteField field control, Microsoft.SharePoint.SPFieldMultiLineText field type) is basically a rich text field with or without the ability to edit rich text. There is a method in the field (SetRichTextMode) that sets the control mode as:

    public enum SPRichTextMode
    {
        Compatible,
        FullHtml,
        HtmlAsXml
    }

    Corresponding to the UI setings:
    Specify the type of text to allow:
      Plain text  
      Rich text (Bold, italics, text alignment)
      Enhanced rich text (Rich text with pictures, tables, and hyperlinks)

    Now the question is what type your multiline textbox is?

    If you are in HTML mode, the content is stored as HTML, for examle, separate lines are in <DIV></DIV> tags.

    The problem you reported is with the plain text mode, where I found the behaviour you described: the line breaks are replaced with spaces.

    Very interesting!

    Peter
    Monday, June 8, 2009 12:41 PM
  • Yes, interesting ;-) ... but is there a workaround?
    Monday, June 8, 2009 1:34 PM
  • Hi,

    You might not like that "workaround" but probably you should implement your own web service to avoid this "effect".
    Walkthrough: Creating a Custom Web Service
    http://msdn.microsoft.com/en-us/library/ms464040.aspx
    Creating a Custom Web Service for SharePoint
    http://it.toolbox.com/blogs/sharepoint-blog/creating-a-custom-web-service-for-sharepoint-13553

    Peter
    Friday, June 26, 2009 6:24 PM
  • Hi,

    Will Microsoft have a fix for this problem in webservice Lists.asmx soon? 

    Is there a way for us to get the source code and make minor modifications?


    Thanks

    Jack T.



    Wednesday, August 26, 2009 4:05 PM
  • Hi Jack,

    I'm not a MS representative, so I can't tell you the official answer for your question. I don't know why it is so hard to implement a patch for this bug, also I don't know if it is a "known bug". But I assume that if it is not corrected in the past two years, it will be not corrected in the next months when most of the developers probably work on the next version of the product.

    Peter
    Wednesday, August 26, 2009 6:41 PM
  • Its check each character’s ASCII value entered into the textbox, so when the enter key is pressed its also check the ASCII value and then it avoid to insert the carriage return value to the textbox. So we can avoid to insert Carriage Return into the textbox having “ Multiline” TextMode property or in TextArea control.

    <asp:TextBox ID="txtComments" Height="150" Columns="200"TextMode="multiline"  MaxLength="4000" runat="server"onkeydown =  "return (event.keyCode!=13);" />

    Note: ASCII value for Enter Key is 13.

    carriage return into Textbox control 



    Cheers, Eliza
    Tuesday, May 11, 2010 9:23 AM