Introduction

There are some inherent behaviors that process designers should be aware of when using an InfoPath integrated process configured with the InfoPath Rich Text Box control. This article presents how the Rich Text Box control is used, and four alternative methods of presenting text within the InfoPath integrated process.

InfoPath Rich Text Box control


The Rich Text Box control makes use of XHTML formatted text to correctly display user input within the control. When users integrate their K2 processes with an InfoPath form that utilizes these controls, the corresponding K2 XML field node within the K2 process is populated with XHTML formatted text (which is the rich text entered by the user).
The K2 XML field node can be located within the K2 Object Browser once the InfoPath integration wizard has been successfully run on an XSN template that contains a Rich Text Box control. Depending on user requirements, this field can be used throughout the process to set content.

Possible problems and alternatives

There are a few scenarios in which users might not want to have the XHTML formatted text displayed, but rather just the plain text. One example would be a SharePoint List Item metadata update or List Item creation, in which the content derived from the Rich Text Box is used to populate the SharePoint item metadata.

When users explicitly set SharePoint List Item column fields to the XHTML formatted text originally entered into a Rich Text Box, the result will be displayed as:
 
Essentially this is the unformatted XHTML from the control on the form. The following suggestions are a few approaches to display plain text from a Rich Text Box control on the InfoPath form.

Use a Multi-line Text Box
By far the simplest alternative is to consider whether or not Rich Text is needed at all. Since the content will be ultimately stripped of format one can simply use the Text Box control available on the InfoPath control group with the display set to multi-line.

  • Right click the control and select Properties
  • Select the Display tab
  • Check the Multi-line check box

A multi-line plain text entry box will display on the form.

 

SharePoint Multi-line enhanced Rich Text
The second alternative is to create a column within the list using the Multiple lines of text option for the type of information, and Enhanced rich text as the type of text to allow.

When the item metadata is updated, the XHTML formatted text from the process XML node is used to set the rich text within the Enhanced Rich Text SharePoint column. The rich text is displayed to the user.

Set equivalent text field to XHTML value
The third alternative is to create a secondary text field within the InfoPath form and create a submit rule that sets the newly created text field’s value to that of the rich text field. This second field is then a plain text equivalent of the XHTML that can be used throughout the process as needed.

Create custom Inline functions
The fourth alternative is to create an inline function that retrieves the XML from the Rich Text Box control and then uses the function in conjunction with the InfoPath process XML field so that the plain text can be extracted and used in the process.
For more information on creating Inline Functions please see the K2 blackpearl help here:
Developer Reference > Extending the K2 Platform > How to create a Custom Inline Function
Or online here:
http://help.k2.com/helppages/k2blackpearl1420/How_to_create_a_Custom_Inline_Function.html

 Image