Friday, August 31, 2012

InfoPath - an example of using an XML file for special characters


This is an old trick relating to inserting special characters (such as carriage returns) and tricking InfoPath to stop removing them! 
I've decided to take some screenshots to show what you should be expecting when you apply this technique.

The XML file

image

The Data Connection

image
image

A formula to use it

image
The advanced Xpath is:
concat("my", xdXDocument:GetDOM("characters")/lookups/characters/@crlf, "hello", xdXDocument:GetDOM("characters")/lookups/characters/@crlf, "world")

Result - Rich Client

image

Result - Web Browser Form

image

The HTML generated in the browser form is:
<TEXTAREA ...>my
hello
world</TEXTAREA>

Notice it has the correct carriage returns creating the new lines.

The example XSN file if you want to download it and have some fun

No comments:

Post a Comment