August 2004 - Posts - Greg Collins
in

InfoPath Dev

This Blog

Syndication

Greg Collins

August 2004 - Posts

  • 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.

  • Choose Your Section Wisely

    I uncovered this problem on 2004-08-18 while hard at work creating a form. It caused me quite a headache at first until I was able to narrow and then finally track down the problem. I've reported it to Microsoft.

    DESCRIPTION:

    The problem seems to stem from inserting a non-repeating group into the view that is contained within repeating group, which is not inserted into the view. The non-repeating group is inserted as a non-repeating Section.

    Here's the walkthrough to reproduce the problem:

    1. Launch InfoPath.
    2. Create a new blank form
    3. Open the Controls task pane.
    4. Insert a Repeating Section in the view.
    5. Insert a Section in the Repeating Section.
    6. Insert a Text Box in the Section.
    7. Select everything in the view and delete it.
    8. Open the Data Source task pane, and then expand the data source tree.
    9. Insert group2 as a Repeating Table in the Section.
    10. Insert group1 as a Section at the bottom of the view. This section would ultimately have conditional visibility added to it.
    11. Click inside the Section to set the insertion point.
    12. Right-click on group2 and then choose More | Section (i.e. non-repeating section)
    13. Drag and drop field1 into the group2 Section.
    14. Preview the form.

      Note that when clicking on the Section that it gets highlighted blue just as the Repeating Table does. We need to eliminate this blue highlighting.

    15. Close the preview.
    16. Delete the group2 Section.
    17. Click inside the Section to set the insertion point.
    18. Right-click on group3 and then choose More | Section (i.e. non-repeating section)
    19. Drag and drop field1 into the group3 Section.
    20. Preview the form.

      Note that when clicking on the Section that it no longer gets the blue highlighting. This worked!

    21. Close the preview.
    22. Choose Extract Form Files from the File menu, choose a folder and then save.
    23. Close InfoPath.
    24. Open the folder you extracted the form files to.
    25. Right-click on the manifest.xsf file and choose Design.

      An error message appears with the following message:

      InfoPath cannot open the following form: {Folder_Path}\manifest.xsf
      Microsoft Office InfoPath cannot open the selected form.


    26. Click OK, and exit InfoPath.
    27. Edit the view1.xsl file in a text editor, such as NotePad.
    28. Search for [1]. You'll find the following line:

      <xsl:apply-templates select="my:group2[1]/my:group3" mode="_13"/>


      Note that the [1] means to select the first instance of group2. This indicates that we chose a non-repeating section when we inserted group3 in the view.

    29. Delete [1], save and then close the view1.xsl file.
    30. Right-click on the manifest.xsf file and choose Design.

      InfoPath opens the form template, but now there are red errors on the group3 Section and on field1.

    When we used a non-repeating Section using group2, it worked, but we had the blue highlighting. The apply-templates in the view for that scenario looked like this:

    <xsl:apply-templates select="my:group2[1]" mode="_12"/>

    So why does InfoPath work when selecting only the first instance of a group, but not when selecting a field within that first instance? Why can you preview the form, but once you save it, you can no longer open it?

    WORKAROUNDS:

    I currently do not know of a workaround for this.

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

  • Make a Filter Work Automatically With No User Interaction

    When you add a filter to a control such as a repeating table, the filter should be able to work automatically (i.e. require no user interaction). If you run into a situation where this is not working, you can try the following steps.

    1. Make a backup of your form template.
    2. Extract your form files to a folder.
    3. Edit the manifest.xsf file in a text editor.
    4. Search for and delete any attribute useFilter="yes" on an xsf:editWith element. Don't delete the element, just the attribute.
    5. Search for and delete any xsf:button elements with the attribute action="xCollection::refreshFilter".
    6. Save the manifest.xsf file and close the text editor.
    7. Right-click the manifest.xsf file and choose Design.
    8. Test the changes.

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

  • Remove a Form Template from the InfoPath Cache

    You might encounter a situation where forms continue to open in a form template that you deleted. This may seem strange until you learn that InfoPath caches form templates. Although you deleted the physical copy, the cached version still exists.

    InfoPath caches form templates the first time they are used. This enables you to use online InfoPath forms when you are offline. It also improves performance. Once both the physical and cached form templates are deleted, forms that use that form template can no longer be opened in InfoPath.

    You can also remove a form template from the InfoPath cache without deleting the physical copy. This is occasionally necessary, when developing a form, in order to view the changes that you have made. In this task we will learn how to remove a form template from the InfoPath cachce.

    Remove a form template from the InfoPath cache:

    1. Launch InfoPath.
    2. In the Fill Out A Form dialog box, select the All Forms category.
    3. Select the form template you want to remove from the InfoPath cache.

    If you do not see the form template listed, select All Forms from the list of Form Categories at the top left of the Fill Out A Form dialog box.

    1. Click Remove This Form from the list of Form Tasks at the top right of the dialog.
    2. Close InfoPath.

    If the above steps fail and you find the old for template is still loading you can try one of the following:

    1. Choose Run from the Start menu, type infopath /cache clearall, and then click OK.
    2. Manually delete cached InfoPath template in the cache folder located at:

      [Vista]: C:\Users\<Username>\AppData\Local\Microsoft\InfoPath\FormCache2
      [XP]: C:\Documents and Settings\<Username>\Local Settings\Application Data\Microsoft\InfoPath\FormCache2

    Try it:

    Once you have deleted both the physical and cached copy of the form template, launch a form file created from that form template. InfoPath will still be launched, but you will receive a warning dialog box stating that the form template cannot be found.

    Open the Form XML Without InfoPath:

    If you want to prevent the form from opening in InfoPath at all, then you need to remove two tags, known as processing-instructions, from your form. Using a text editor, such as Notepad, remove the following two processing-instructions from your form .xml file:

    <?mso-infoPathSolution . . . ?>
    <?mso-application . . . ?>

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

  • Display a Linked Picture from a Parameterized Active Server Page

    You might need to display a custom picture in your form based on field values. You can do this using an Active Serve Page that takes parameters. Your Active Serve Page might return a barcode, a map, a photograph, or any other kind of picture. Your form will use the Linked Picture control.

    In this task we will show how to set up the linked picture binding to retrieve a picture from an Active Server Page using two field values from the main data source. We assume that you already have an existing Active Server Page capable of accepting parameters and returning a picture. Let's start by designing a new blank form.

    Add the parameter fields to your main data source:

    1. Open the Data Source task pane.
    2. Add two Text Fields named Param1 and Param2.

    Create a custom linked picture binding:

    1. Open the Controls task pane.
    2. Insert a picture into the view.
    3. In the Insert Picture Control dialog box, select As A Link, and then click OK.
    4. Double-click the picture control in the view.
    5. In the Picture Properties dialog box, replace the XPath with the following:

    concat("http://server/picture.asp?param1=", my:Param1, "&param2=", my:Param2)

    Make the appropriate adjustments to the URL to match your server, Active Serve Page and parameter names.

    1. Clear the Allow The User To Browse For New Pictures check box, and then click OK.

    Try it:

    Preview your form. Assuming your URL is valid and the ASP page is working correctly, when you enter valid values into the Param1 and Param2 fields, you will see your picture correctly updated.

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

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