Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 262610 - Last Review: October 15, 2002 - Revision: 1.2
FIX: Oncellchange() Event of the XML DSO Fires Twice
This article was previously published under Q262610
The
oncellchange() event of the XML Data Source Object (DSO) is fired when the value of an XML data element is modified in scripting code. This event fires twice in succession in MSXML 2.0, which is not the desired behavior.
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
This problem has been fixed in the MSXML 2.5 parser.
You can obtain the most current parser update on the MSDN page at the following Microsoft Web site:
In the following code, the XML DSO is used to bind an XML data island to an HTML table. The VBScript procedure
Notify() in the SCRIPT tag is run when the
oncellchange() event of the DSO is fired.
The
onClick() event of the
Change Name button element on the HTML page triggers the VBScript
changename() procedure in the SCRIPT tag. The
changename() procedure modifies the text of the Name element in the XML data, which causes the
oncellchange() event of the XML DSO to fire and the VBScript
Notify() procedure to run.
Steps to Reproduce Behavior
- Cut and paste the following code into a text file in Microsoft Notepad and save it as CellChangeTest.htm in a folder on your hard drive:
<html>
<body>
<SCRIPT Language="VBScript">
Sub changename()
xmldso.XMLDocument.selectSingleNode("//Name").text = "David"
End Sub
Sub Notify()
Msgbox "Name has changed"
End Sub
</SCRIPT>
<xml id="xmldso" oncellchange="Notify">
<People>
<Person>
<Name>John</Name>
<Phone>727-879-8765</Phone>
<Email>john@xyz.com</Email>
</Person>
</People>
</xml>
<table datasrc=#xmldso border=1>
<thead>
<th>Name</th>
<th>Phone</th>
<th>Email</th>
</thead>
<tr>
<td><div datafld="Name"></div></td>
<td><div datafld="Phone"></div></td>
<td><div datafld="Email"></div></td>
</tr>
</table>
<p><input type="Button" value="Change Name" onClick="changename">
</body>
</html>
- Open CellChangeTest.htm in Internet Explorer, and note that
the page displays an HTML table that is bound to the XML data.
- Click the Change Name button, and note that the message box that contains the Name has changed text is displayed twice in succession.
| kbbug kbfix kbmsxml250fix KB262610 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate