M
mbenbow
This has happened to me more than once when coding in VBScript for an
InfoPath form. If you know that your XPath statement is correct using
Xdocument.DOM.SelectSingleNode("//my:FieldName") but an error keeps
occuring in the script file telling you that an Object is required.
Ensure that the following namespaces in the script file are as follows.
'<namespacesDefinition>
XDocument.DOM.setProperty "SelectionNamespaces",
"xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xmlnsd=""urn:schemas-microsoft-comfficedata""
xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD""
xmlns:xd=""http://schemas..microsoft.com/office/infopath/2003"""
'</namespacesDefinition>
Somtimes, when InfoPath creates the script file, it leaves off a name
space. In each instance that this has occurred the
xmlnsd=""urn:schemas-microsoft-comfficedata""
was missing and therefore the form did not understand how to reference
the XML element in code. Adding the namespace to the script file
resolved the issue.
Hope it helps someone else.
InfoPath form. If you know that your XPath statement is correct using
Xdocument.DOM.SelectSingleNode("//my:FieldName") but an error keeps
occuring in the script file telling you that an Object is required.
Ensure that the following namespaces in the script file are as follows.
'<namespacesDefinition>
XDocument.DOM.setProperty "SelectionNamespaces",
"xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xmlnsd=""urn:schemas-microsoft-comfficedata""
xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD""
xmlns:xd=""http://schemas..microsoft.com/office/infopath/2003"""
'</namespacesDefinition>
Somtimes, when InfoPath creates the script file, it leaves off a name
space. In each instance that this has occurred the
xmlnsd=""urn:schemas-microsoft-comfficedata""
was missing and therefore the form did not understand how to reference
the XML element in code. Adding the namespace to the script file
resolved the issue.
Hope it helps someone else.