InfoPath Q&A: How do I add a carriage return to the Default Value of a Rich Text Box?

by S.Y.M. Wong-A-Ton | Filed under: InfoPath 2007

Jim wrote:

Is there a way to add a carriage return in a rich text box’s default value? I have had success with a normal text box using an XML file that contains UTF-8 CR and LF characters, but at this point I have not found a way to add either to in a Rich Text Box.

Hi Jim,

As far as I know, you cannot do this without writing code. The way to add a carriage return to a Rich Text Box is by programmatically adding a <div> element to the InnerXml property of the XML node that represents the Rich Text Box. I wrote some code for this in this forum thread.

To set the Default Value of the field, you would have to write code in an event handler. You’ve got the choice of using the loading event of the form (this would set the value when the form is opened for the first time) or – like I wrote yesterday – the changed event of a row in a repeating table (this would set the value when a repeating table row is inserted).

Update (14 Dec 2008): Also take a look at the following articles:

Related Posts

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent of S.Y.M. Wong-A-Ton. Usage of techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author, S.Y.M. Wong-A-Ton.

InfoPath 2010 Cookbook

InfoPath 2010 Cookbook 2: 101 Codeless Recipes for SharePoint 2010