W
waffle93
I created a form and added some VBScript code to it. After having
difficulties with the code I deleted all of it. Now I am adding code back to
the form but cannot reference any of the fields in it, apparently because it
does not recognize the namespace declaration.
The error I receive is:
After troubleshooting I figured out that you can't just copy in a substitute
for the namespace declaration that InfoPath automatically puts in your script
the first time you write to it. I tested this by creating a new, blank form
and added one field and one button. If I use the auto-generated namespace
declaration then clicking the button will display the value of the text box.
If I copy over the namespace declaration (with a different timestamp) then I
get the same error as above.
The code is as simple as this:
---------------------------------
'<namespacesDefinition>
XDocument.DOM.setProperty "SelectionNamespaces",
"xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-03-03T19:04:56"""
'</namespacesDefinition>
Sub CTRL2_5_OnClick(eventObj)
myText = XDocument.DOM.selectSingleNode("/my:myFields/my:dummyField").Text
msgbox myText
End Sub
---------------------------------
....so what is going on here? If the timestamp in the namespace declaration
is sensitive to each form then how do I re-create this for my form?
Also...curious...does the form query schemas.microsoft.com every time it
opens to translate the namespace?
difficulties with the code I deleted all of it. Now I am adding code back to
the form but cannot reference any of the fields in it, apparently because it
does not recognize the namespace declaration.
The error I receive is:
After troubleshooting I figured out that you can't just copy in a substitute
for the namespace declaration that InfoPath automatically puts in your script
the first time you write to it. I tested this by creating a new, blank form
and added one field and one button. If I use the auto-generated namespace
declaration then clicking the button will display the value of the text box.
If I copy over the namespace declaration (with a different timestamp) then I
get the same error as above.
The code is as simple as this:
---------------------------------
'<namespacesDefinition>
XDocument.DOM.setProperty "SelectionNamespaces",
"xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-03-03T19:04:56"""
'</namespacesDefinition>
Sub CTRL2_5_OnClick(eventObj)
myText = XDocument.DOM.selectSingleNode("/my:myFields/my:dummyField").Text
msgbox myText
End Sub
---------------------------------
....so what is going on here? If the timestamp in the namespace declaration
is sensitive to each form then how do I re-create this for my form?
Also...curious...does the form query schemas.microsoft.com every time it
opens to translate the namespace?