BUG: Items in a drop-down list control are unexpectedly removed in InfoPath 2003 Service Pack 1 (888701)



The information in this article applies to:

  • Microsoft Office InfoPath 2003, Service Pack 1 (SP1)

SYMPTOMS

When you click an item in a drop-down list control, and then you reopen the drop-down list control, you notice that all items in the drop-down list control are unexpectedly removed, except the last item. This problem occurs in Microsoft Office InfoPath 2003 Service Pack 1 (SP1).

CAUSE

The view does not update when the value of the drop-down list changes.

WORKAROUND

To work around this problem, force the view to update when the drop-down list control changes. To force the view to update, follow these steps:
  1. Start InfoPath.
  2. Open the form.

    The drop-down list control should be in Design mode.
  3. Right-click the drop-down list control, and then click Drop-Down List Box Properties.
  4. In the Drop-Down List Box Properties dialog box, click Data Validation on the Data tab.
  5. In the Data Validation dialog box, click OnAfterChange in the Event drop-down list.
  6. In the Microsoft Script Editor window, click Edit. Put the following code example in the OnAfterChange event handler.
    XDocument.View.ForceUpdate();	
  7. The event handler function will look as follows.
    function msoxd__choices__MyChoice::OnAfterChange(eventObj)
    {
       XDocument.View.ForceUpdate();
    }
  8. On the File menu, click Save, and then close the Microsoft Script Editor window.
  9. Click OK two times.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to reproduce the problem

  1. Create an .xml file and put the following script in the file. Save the file as "Choices.xml."
    <?xml version="1.0" ?>
    <ChoiceXML>
    	<MyChoice></MyChoice>
    </ChoiceXML>
  2. Start InfoPath.
  3. On the File menu, click Design a Form.
  4. In the Design a new form pane, click New Blank Form.
  5. In the Design Tasks pane, click Controls, and then add a Repeating Table to the form.
  6. Type 1 for Number of columns, and then click OK.
  7. On the Tools menu, click Data Connections.
  8. In the Data Connections dialog box, click Add.
  9. In the Data Connection Wizard, click to select the Receive data check box, and then click Next.
  10. Click XML document, and then click Next.
  11. Type the path of the "Choices.xml" file, and then click Next.
  12. Click Finish, and then click Close.

    Note Click No if you receive the following message:

    The selected file is not part of the form, which means it might not be accessible from other computers. Do you want to add this file to your form so that it will be accessible from other computers?
  13. On the View menu, click Data Source, and then click choices Secondary in the Data source drop-down list.
  14. Expand ChoiceXML, right-click MyChoice, and then click Drop-Down List Box.
  15. Right-click the drop-down list box control, and then click Drop-Down List Box Properties.
  16. In the Drop-Down List Box Properties dialog box, click the Data tab, and then click Look up values in the form's data source.
  17. Click Select XPath next to the Entries box.
  18. In the Select a Field or Group box, expand all the fields, click field1, and then click OK two times.
  19. On the Standard toolbar, click Preview Form.
  20. Click Insert Item two times, type test, type test1, and then type test2 in each text box respectively in the Repeating Table control.
  21. Click the My Choice drop-down list.

    Notice that test, test1, and test2 are listed.
  22. Click test.
  23. Click the My Choice drop-down list again.

    Notice that only test is listed.

Modification Type:MinorLast Reviewed:7/28/2006
Keywords:kbProgramming kbXML kbtshoot kbbug KB888701 kbAudDeveloper kbAudITPRO