{"id":45,"date":"2008-12-16T16:38:37","date_gmt":"2008-12-17T00:38:37","guid":{"rendered":"http:\/\/sharepoint.bryanfriedman.com\/index.php\/2008\/12\/16\/multiple-lines-of-text-in-infopathsharepoint\/"},"modified":"2008-12-16T16:38:37","modified_gmt":"2008-12-17T00:38:37","slug":"multiple-lines-of-text-in-infopathsharepoint","status":"publish","type":"post","link":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/2008\/12\/16\/multiple-lines-of-text-in-infopathsharepoint\/","title":{"rendered":"Multiple Lines of Text in InfoPath\/SharePoint"},"content":{"rendered":"<p><strong>Scenario: <\/strong>You have built an InfoPath form that you publish to SharePoint to be filled out in a browser-enabled form using Forms Services.&nbsp; This form includes a simple text field that accepts multiple lines of text and does not explicitly set a maximum number of characters.&nbsp; When you publish this form to SharePoint and map the fields to Site Columns, this field is mapped to a &#8220;single line of text&#8221; field, and <em>the default max character length is set to 255<\/em>.&nbsp; <em>Any characters entered into the field above this length are truncated when the data is entered into the column in SharePoint.<\/em><\/p>\n<p>I came across this scenario recently and had to do some digging to find out what the issue was and what the best way to solve it was.&nbsp; <\/p>\n<p>First, here&#8217;s a sample form that will produce this scenario:<\/p>\n<p><a href=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px\" height=\"364\" alt=\"image\" src=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image-thumb.png\" width=\"504\" border=\"0\"><\/a> <\/p>\n<p>The properties in InfoPath for this text box are as follows:<\/p>\n<p>&nbsp;<a href=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image1.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px\" height=\"298\" alt=\"image\" src=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image-thumb1.png\" width=\"254\" border=\"0\"><\/a> <a href=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image2.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px\" height=\"298\" alt=\"image\" src=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image-thumb2.png\" width=\"254\" border=\"0\"><\/a> <\/p>\n<p>As mentioned above, publishing this form to a SharePoint Form Library and entering more than 255 characters into this field will result in truncating the contents of the field when it is stored in the column in SharePoint.&nbsp; This is (probably) not the behavior intended.&nbsp; One way to handle this is to just limit the length of characters allowed in this field to 255.&nbsp; By the way, this doesn&#8217;t appear to be as easy as clicking the &#8220;Limit text box to:&#8221; checkbox because, as you can see above, it is grayed out when &#8220;Multi-line&#8221; is selected.&nbsp; (You&#8217;d have to do some Data Validation using the string-length function &#8212; ugly.)&nbsp; Anyway, if you did this, it would eliminate the possibility of truncating the contents, but of course, you may actually want your users to be able to enter more than 255 characters.&nbsp; So what&#8217;s the solution.<\/p>\n<p>Well, apparently when publishing an InfoPath form to SharePoint, it automatically maps &#8220;string&#8221; fields to &#8220;single line of text&#8221; fields.&nbsp; In order to map to a &#8220;multiple lines of text&#8221; field, you have to use an &#8220;XHTML&#8221; field, which is a &#8220;Rich Text&#8221; field in InfoPath:<\/p>\n<p><a href=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image3.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px\" height=\"365\" alt=\"image\" src=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image-thumb3.png\" width=\"504\" border=\"0\"><\/a> <\/p>\n<p><a href=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image4.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px\" height=\"320\" alt=\"image\" src=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image-thumb4.png\" width=\"254\" border=\"0\"><\/a> <a href=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image5.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px\" height=\"320\" alt=\"image\" src=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image-thumb5.png\" width=\"254\" border=\"0\"><\/a> <\/p>\n<p>Publishing this form and mapping the Rich Text field to the column in SharePoint will result in setting the column to be &#8220;multiple lines of text&#8221; rather than &#8220;single line of text.&#8221;&nbsp; However, there is one small annoyance with this.&nbsp; Notice the message in the display properties above that says &#8220;Only full rich text without embedded images is supported in browser-enabled form templates.&#8221;&nbsp; Annoying.&nbsp; It means you get this stupid control on your form instead of regular plain text:<\/p>\n<p><a href=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image6.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px\" height=\"385\" alt=\"image\" src=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image-thumb6.png\" width=\"454\" border=\"0\"><\/a> <\/p>\n<p>So how can have a regular text field and still map it to a &#8220;multiple lines of text&#8221; field in SharePoint.&nbsp; Here&#8217;s what I came up with.<\/p>\n<ol>\n<li>Create a regular text box (string) control in InfoPath.\n<li>Create a rich text box (XHTML) field in InfoPath, but don&#8217;t display it on the form.\n<li>Create a rule on the regular text box that sets the value of the rich text box to the current value of the regular text box.\n<li>Map only the rich text box value to a column in SharePoint.<\/li>\n<\/ol>\n<p>You should be able to handle steps one and two based on the screenshots above.&nbsp; Here are some quick screenshots to show you what I&#8217;m talking about for steps three and four.<\/p>\n<p>On the regular text box (string) control, create a rule to set the value of the rich text box:<\/p>\n<p><a href=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image7.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px\" height=\"267\" alt=\"image\" src=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image-thumb7.png\" width=\"334\" border=\"0\"><\/a> <\/p>\n<p>Finally, only map the rich text box value to a column in SharePoint (not the regular text box):<\/p>\n<p><a href=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image8.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px\" height=\"384\" alt=\"image\" src=\"https:\/\/archive.bryanfriedman.me\/sharepoint\/wp-content\/uploads\/2008\/12\/image-thumb8.png\" width=\"504\" border=\"0\"><\/a> <\/p>\n<p>Notice the &#8220;plaintext&#8221; in parenthesis.&nbsp; The regular text box field won&#8217;t have that listed.&nbsp; I&#8217;m not even entirely sure what it means, but it seems to only show up for XHTML (rich text) fields instead of string fields.<\/p>\n<p>This feels like a pretty roundabout way of getting what you want, but then again, the more I work with InfoPath and Forms Services, the more I realize that roundabout ways of getting what you want pretty much seem to be par for the course.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scenario: You have built an InfoPath form that you publish to SharePoint to be filled out in a browser-enabled form using Forms Services.&nbsp; This form includes a simple text field that accepts multiple lines of text and does not explicitly set a maximum number of characters.&nbsp; When you publish this form to SharePoint and map [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-45","post","type-post","status-publish","format-standard","hentry","category-development"],"_links":{"self":[{"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/posts\/45","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":0,"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"wp:attachment":[{"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}