Bringing Expressions Out of the Box - Greg Collins
in

InfoPath Dev

This Blog

Syndication

Greg Collins

Bringing Expressions Out of the Box

I uncovered this problem on 2004.09.17. I actually noticed it happening several weeks earlier, but didn't have the time then to find out what was going on. I've reported this problem to Microsoft.

In order to avoid numerous potential problems, when you copy from one form and paste into another, InfoPath breaks all bindings, removes all rules, conditional formatting, etc. But one place it breaks where it shouldn't is when pasting an expression box with a text value.

Here's the walkthrough to reproduce the problem:

Create the first form template:

  1. Design a new blank form.
  2. Insert an Expression Box from the Controls task pane using the following XPath (including quotes):

    “This is a test”

  3. Copy the expression box to the clipboard.

Create the second form template:

  1. Choose Design A Form from the File menu.
  2. In the Design A Form task pane, click New Blank Form.
  3. Paste the copied expression box into the view.

  4. As shown in the Figure 1, the Expression Box Properties dialog shows the Data Source option as selected, with no XPath specified, instead of the Text option. Yet the control clearly still shows the text we entered.


    Figure 1: The expression box is incorrectly bound.

At this point your expression box will continue to show the text you typed, but any functionality you attempt to place on the expression box, such as conditional formatting, will fail.

Let's take a look at the difference between the two forms to see what happened. We'll be looking selections from the view1.xsl file.

Differences in the view1.xsl file:

Form template 1:

<div>
    <span class="xdExpressionBox xdDataBindingUI" title="" tabIndex="-1" xd:xctname="ExpressionBox" xd:disableEditing="yes" xd:CtrlId="CTRL1" style='WIDTH: 145px'>
        <xsl:value-of select="&quot;This is a test&quot;"/>
    </span>
</div>

Form template 2:

<div>
    <span class="xdExpressionBox xdDataBindingUI" title="" xd:xctname="ExpressionBox" xd:CtrlId="CTRL1" style='WIDTH: 145px'>This is a test</span>
</div>

As you can see there is a significant difference in the view1.xsl file, effectively breaking the expression box.

Workaround:

Reenter your text into the Expression Box Properties dialog box.

©2004 Greg Collins. All rights reserved. Licensed to Autonomy Systems, LLC for display on InfoPathDev.com.

Comments

No Comments
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.