<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Call Infopath with JScript...</title><link>https://www.infopathdev.com:443/forums/thread/14393.aspx</link><pubDate>Sun, 19 Mar 2006 14:54:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14393</guid><dc:creator>Karsten Brocksieper</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14393.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14393</wfw:commentRss><description>Hello,&lt;br /&gt;&lt;br /&gt;...in the meantime I have found a solution which I want to share for anyone who is interested in.&lt;br /&gt;&lt;br /&gt;The problem in my code was the correct declaration of the namespace.&lt;br /&gt;If you don´t declare the -really- exact namespace for the property 'SelectionNamespaces' the above mentioned code will failed.&lt;br /&gt;&lt;br /&gt;You can determine the exact namespace definition for the used form template with the method 'namespaceURI' as I show in the following line:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;var oXMLDocNamespace = oXMLDocument.selectSingleNode("/*[1]").namespaceURI;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Now you can set the correct value for the 'SelectionNamespaces' property:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;oXMLDocument.setProperty("SelectionNamespaces","xmlns:my='" + oXMLDocNamespace + "'");&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;So, the whole working code looks like...&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;var oApp = new ActiveXObject("InfoPath.Application");&lt;br /&gt;var oXDocumentCollection = oApp.XDocuments;&lt;br /&gt;var oXDocument = oXDocumentCollection.NewFromSolution("file:///C:\\Mytemplate.xsn");&lt;br /&gt;var oXMLDocument = oXDocument.DOM;&lt;br /&gt;var oXMLDocNamespace = oXMLDocument.selectSingleNode("/*[1]").namespaceURI;&lt;br /&gt;&lt;br /&gt;oXMLDocument.setProperty("SelectionNamespaces","xmlns:my='" + oXMLDocNamespace + "'");&lt;br /&gt;&lt;br /&gt;oXMLDocument.selectSingleNode("//my:myFields//my:singleFieldname").text = "This is a new value";&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;HTH,</description></item><item><title>Re: Call Infopath with JScript...</title><link>https://www.infopathdev.com:443/forums/thread/14392.aspx</link><pubDate>Fri, 17 Mar 2006 07:31:15 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14392</guid><dc:creator>Karsten Brocksieper</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14392.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14392</wfw:commentRss><description>Hi Matt,&lt;br /&gt;&lt;br /&gt;thank you for your advice. Yes, I know that the problem is the XPath expression but that exactly is my problem ;-((&lt;br /&gt;&lt;br /&gt;I´ve tried various syntax for the XPath expression beginning from &lt;br /&gt;&lt;br /&gt;...("meineFelder:txtTelefon").text to ...("//my:myFields//my:txtTelefon).Text&lt;br /&gt;&lt;br /&gt;but all without success...&lt;br /&gt;&lt;br /&gt;Therefore I hoped that someone can show me the correct XPath expression in this case.&lt;br /&gt;&lt;br /&gt;Thank you very much.&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Re: Call Infopath with JScript...</title><link>https://www.infopathdev.com:443/forums/thread/14391.aspx</link><pubDate>Thu, 16 Mar 2006 21:16:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14391</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14391.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14391</wfw:commentRss><description>This is a common error and it almost always has to do with your XPath expression. It sounds like you have checked this against your data source to make sure that it is correct, but that's the only action I would suggest.</description></item><item><title>Call Infopath with JScript...</title><link>https://www.infopathdev.com:443/forums/thread/12817.aspx</link><pubDate>Thu, 16 Mar 2006 14:34:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12817</guid><dc:creator>Karsten Brocksieper</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12817.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12817</wfw:commentRss><description>Hello,&lt;br /&gt;&lt;br /&gt;I would like to set values in an infopath form from outside of infopath. Therefore I have written a small javascript to access the Infopath object modell.&lt;br /&gt;&lt;br /&gt;Now I have a problem with setting the information in the appropriate fields in the form.&lt;br /&gt;&lt;br /&gt;In the following you will find my script and everthing works fine --- without the last line. ;-(((&lt;br /&gt;&lt;br /&gt;var oApp = new ActiveXObject("InfoPath.Application");&lt;br /&gt;WScript.Echo("InfoPath Version: " + oApp.Version);&lt;br /&gt;&lt;br /&gt;var oXDocumentCollection = oApp.XDocuments;&lt;br /&gt;var oXDocument = oXDocumentCollection.NewFromSolution("file:///C:\\InfopathFormCall.xsn");&lt;br /&gt;var oXMLDocument = oXDocument.DOM;&lt;br /&gt;&lt;br /&gt;oXMLDocument.setProperty("SelectionNamespaces","xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-01-19T21:16:49'");&lt;br /&gt;&lt;br /&gt;&lt;font color="red"&gt;&lt;b&gt;oXMLDocument.selectSingleNode("/my:meineFelder/my:txtTelefon").text = "New value";&lt;/b&gt;&lt;/font id="red"&gt;&lt;br /&gt;&lt;br /&gt;I get the error message that 'oXMLDocument.selectSingleNode(...)' is Null or not an object...&lt;br /&gt;&lt;br /&gt;BTW: 'meineFelder' is the german expression for 'myfields' but replacing this will result in the same error message.&lt;br /&gt;&lt;br /&gt;Can someone help me to get the correct syntax for accessing the selectSingleNode object.&lt;br /&gt;&lt;br /&gt;Any help is greatly appreciated&lt;br /&gt;</description></item></channel></rss>