Expressions of Dissociative Identity Disorder - Greg Collins
in

InfoPath Dev

This Blog

Syndication

Greg Collins

Expressions of Dissociative Identity Disorder

I uncovered this problem on 2004.08.20 while transferring some work from a form I had created earlier to a similar form I was working on. Af first I thought it was a curious little thing, but didn't give much thought to it as I was against a deadline. But later that night, it all came back to me and I was able to put together a short repro the next morning. I've reported this problem to Microsoft.

It appears that when copying an Expression Box from one form to another the bindings are lost, even if the schema is identical. During the rebinding process, something snaps in the brain of the Expression Box and suddenly it takes on a whole new personality—specifically, that of a Text Box. Here's the walkthrough to reproduce the problem:

Create the sample forms:

  1. Create a new blank form.
  2. From the Controls task pane, insert a Text Box into the view.
  3. From the Data Source task, insert field1 into the view as an Expression Box.
  4. Right-click on the Expression Box and then choose Copy.

  5. Create a second new blank form.
  6. From the Controls task pane, insert a Text Box into the view.
  7. Paste the copied Expression Box into the view. The control will be unbound.
  8. Preview the form.

    Everything is as expected, the text box is editable, and the unbound expression box does nothing.

  9. Close the preview.

Repro the bug:

  1. Right-click on the pasted Expression box and choose Change Binding.
  2. In the Expression Box Binding dialog box, select field1, and then click OK.
  3. Preview the form.
  4. Hover over the Expression Box. Notice that the border highlights.
  5. Click on the Expression Box, and start typing, and then press Tab.

    The Expression Box has now become a Text Box.

  6. Close the preview.
  7. Delete the Expression Box and reinsert it from the Data Source task pane.
  8. Preview the form.

    The Expression Box is no longer editable.

One side note is that you get equally strange behavior, with a few extra benign side effects, when you rebind the pasted Expression Box to a Rich Text node.

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

Comments

 

Ryan Beesley said:

I've run into a similar problem with Infopath 2007 when just moving the field data sources around.  The expression validates correctly, but when trying to preview the page you get the unhelpful message:

Microsoft Office InfoPath

-------------------------------

InfoPath cannot open the selected form.

-------------------------------

OK

I am unsure what exactly is broken in this expression, but it has something to do with referencing nodes that are in an optional section I believe.

January 7, 2009 8:01 PM
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.