<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Opening an IP form with JS</title><link>https://www.infopathdev.com:443/forums/thread/21551.aspx</link><pubDate>Mon, 09 Jul 2007 14:22:42 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21551</guid><dc:creator>ErikvanD</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21551.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=21551</wfw:commentRss><description>&lt;p&gt;Hi Clay,&lt;/p&gt;&lt;p&gt;Thank you for your help. I have tried your script you posted above. But I still get the same error. So I included a messagebox just before &amp;quot;Update the fields&amp;quot; . I also changed the place of the &amp;quot;Dimensie&amp;quot; field on my IP form to being not the first field on the form. Purpose was to see if the cursor really gets to the correct field after opening the form. Well the&amp;nbsp;the script correcty opens the form but the cursor remains at the first field (so not the one I put in the script) and it does not fill out a value. Then it gives the same error again (null or no object).&lt;/p&gt;&lt;p&gt;I have also tried it on my original form that connects to a SQL database (I used a very much simplified version to test the correct filling from the JS). Same error. When I use the following dataconnectionstring:&lt;strong&gt; //dfs:myFields/dfs:dataFields/d:tbl_prog/@Dimensiecode_1 &lt;/strong&gt;I get the error that &amp;quot;d: is an undeclared namespace prefix&amp;quot;.&lt;/p&gt;&lt;p&gt;So, not very succesful so far... Any ideas? To be honest, after strugging to get it to work for a week now I am getting pretty fed up with it..... but on the other hand, I am sure that it could work!&lt;/p&gt;&lt;p&gt;Cheers,&amp;nbsp;Erik&amp;nbsp;&lt;/p&gt;&lt;p&gt;PS: One other question: in your script where do you actually fill the param1 etc with an actual value? I would like to open my form with the value &amp;quot;84011&amp;quot; in the field &amp;quot;Dimensie&amp;quot;.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Opening an IP form with JS</title><link>https://www.infopathdev.com:443/forums/thread/21516.aspx</link><pubDate>Fri, 06 Jul 2007 16:26:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21516</guid><dc:creator>Clay Fox</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21516.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=21516</wfw:commentRss><description>&lt;p&gt;Hey Erik.&lt;/p&gt;&lt;p&gt;Looking at this closer it appears you are trying to set a main data connection to a database.&amp;nbsp; If that is so then I am not sure your xpath is correct it would typically be /dfs:myFields/dfs:queryFields/dfs:Dimensie&lt;/p&gt;&lt;p&gt;Maybe the namespace thing you have works, I have not tried that before.&lt;/p&gt;&lt;p&gt;If you are not planning on using a variable and passing the number to query in then you could just have rules to accomplish this in the template when it opens.&lt;/p&gt;</description></item><item><title>Re: Opening an IP form with JS</title><link>https://www.infopathdev.com:443/forums/thread/21515.aspx</link><pubDate>Fri, 06 Jul 2007 16:18:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21515</guid><dc:creator>Clay Fox</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21515.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=21515</wfw:commentRss><description>&lt;p&gt;Here is what&amp;nbsp;I have used successfully before.&lt;/p&gt;&lt;p&gt;This allows for the parmeters to be passed on the command line.&amp;nbsp; A couple things to watch out for is that you may have to specify your path to infopath or run this in the same folder.&amp;nbsp; Also If you do not have the exact amount of variables it wont work.&amp;nbsp; So if you only need one variable eliminate the others in the script.&lt;/p&gt;&lt;p&gt;//myscript.js&lt;/p&gt;&lt;p&gt;//parse parameters&lt;/p&gt;&lt;p&gt;if(WScript.Arguments.count()==3)&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;var param1 = WScript.Arguments.Item(0);&lt;/p&gt;&lt;p&gt;var param2 = WScript.Arguments.Item(1);&lt;/p&gt;&lt;p&gt;var param3 = WScript.Arguments.Item(2);&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;//Start the application&lt;/p&gt;&lt;p&gt;var oApp = new ActiveXObject(&amp;quot;InfoPath.Application&amp;quot;);&lt;/p&gt;&lt;p&gt;WScript.Echo(&amp;quot;InfoPath Version: &amp;quot; + oApp.Version);&lt;/p&gt;&lt;p&gt;//Open an InfoPath document from the published template&lt;/p&gt;&lt;p&gt;var oXDocumentCollection = oApp.XDocuments;&lt;/p&gt;&lt;p&gt;var oXDocument = oXDocumentCollection.NewFromSolution(&amp;quot;&lt;a href="http://insideen/sites/hrs/am/workflow/forms/template.xsn"&gt;http://insideen/sites/hrs/am/workflow/forms/template.xsn&lt;/a&gt;&amp;quot;);&lt;/p&gt;&lt;p&gt;oXDocument.DOM.setProperty(&amp;quot;SelectionNamespaces&amp;quot;, &amp;quot;xmlns:dfs=&amp;#39;http://schemas.microsoft.com/office/infopath/2003/dataFormSolution&amp;#39; xmlns:my=&amp;#39;http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-04T22:36:39&amp;#39;&amp;quot;); &lt;/p&gt;&lt;p&gt;// Get pointers to the target fields&lt;/p&gt;&lt;p&gt;var oNum = oXDocument.DOM.selectSingleNode(&amp;quot;//dfs:myFields/my:Header/my:ActionID&amp;quot;);&lt;/p&gt;&lt;p&gt;var oName = oXDocument.DOM.selectSingleNode(&amp;quot;//dfs:myFields/my:Header/my:EmpName&amp;quot;);&lt;/p&gt;&lt;p&gt;var oJob = oXDocument.DOM.selectSingleNode(&amp;quot;//dfs:myFields/my:Header/my:JobTitle&amp;quot;);&lt;/p&gt;&lt;p&gt;&lt;br /&gt;//Update the fields&lt;/p&gt;&lt;p&gt;oNum.text = param1;&lt;/p&gt;&lt;p&gt;oName.text = param2;&lt;/p&gt;&lt;p&gt;oJob.text = param3;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;//Submit the Form&lt;/p&gt;&lt;p&gt;//oXDocument.Submit();&lt;/p&gt;&lt;p&gt;//Close up shop&lt;/p&gt;&lt;p&gt;//oXDocumentCollection = null;&lt;/p&gt;&lt;p&gt;//oApp.Quit();&lt;/p&gt;&lt;p&gt;//oApp = null;&lt;/p&gt;&lt;p&gt;You would not assign your node to the namespace I think is your issue. You need to define a variable linked to the field and then set the value of that field.&lt;/p&gt;&lt;p&gt;You should be able to add your query command and you see that this script has a submit and close commands commented out.&lt;/p&gt;&lt;p&gt;So the form is left open ready for additional use when it is done.&amp;nbsp; &lt;/p&gt;&lt;p&gt;Have Fun.&lt;/p&gt;</description></item><item><title>Opening an IP form with JS</title><link>https://www.infopathdev.com:443/forums/thread/21493.aspx</link><pubDate>Fri, 06 Jul 2007 06:21:38 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21493</guid><dc:creator>ErikvanD</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21493.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=21493</wfw:commentRss><description>&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Verdana"&gt;Hey all,&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Verdana"&gt;&amp;nbsp;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;Being totally new to Infopath (2003) and almost new to JS I have been struggling with an IP form for several days now&amp;hellip; &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;I have a simple form that I would like to call with a JS that fills out the first field on the form. Also very similar to:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;&lt;a href="http://www.infopathdev.com/forums/thread/14393.aspx" target="_blank" title="http://www.infopathdev.com/forums/thread/14393.aspx"&gt;this post&lt;/a&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;&lt;a href="http://www.infopathdev.com/forums/thread/21212.aspx" target="_blank" title="http://www.infopathdev.com/forums/thread/21212.aspx"&gt;and this one&lt;/a&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;I have been searching this forum, the internet and several IP books but cannot find the solution. I guess it might have to do something with namespaces but as I do not have a debugger or the IP tookit it is hard to find the error.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;This is my code:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;span&gt;&lt;font face="Verdana"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;span&gt;&lt;font face="Verdana"&gt;//Start the application&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;span&gt;&lt;font face="Verdana"&gt;var oApp = new ActiveXObject(&amp;quot;InfoPath.Application&amp;quot;);&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;span&gt;&lt;font face="Verdana"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;span&gt;&lt;font face="Verdana"&gt;//Open an InfoPath document from the published template&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;span&gt;&lt;font face="Verdana"&gt;var oXDocumentCollection = oApp.XDocuments;&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;span&gt;&lt;font face="Verdana"&gt;var oXDocument = oXDocumentCollection.NewFromSolution(&amp;quot;file:///C:\\temp\\prog_1.xsn&amp;quot;);&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;span&gt;&lt;font face="Verdana"&gt;var oXMLDocument = oXDocument.DOM;&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;font face="Verdana"&gt;var oXMLDocNamespace = oXMLDocument.selectSingleNode(&amp;quot;/*[1]&amp;quot;).namespaceURI;&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;span&gt;&lt;font face="Verdana"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;span&gt;&lt;font face="Verdana"&gt;oXMLDocument.setProperty(&amp;quot;SelectionNamespaces&amp;quot;,&amp;quot;xmlns:dfs =&amp;#39;&amp;quot; + oXMLDocNamespace + &amp;quot;&amp;#39;&amp;quot;);&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;font face="Verdana"&gt;var oID = oXMLDocument.selectSingleNode(&amp;quot;/dfs:myFields/dfs:Dimensie&amp;quot;).text = 84011;&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;font face="Verdana"&gt;&amp;nbsp;&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;span&gt;&lt;font face="Verdana"&gt;//Query the database&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;span&gt;&lt;font face="Verdana"&gt;oXDocument.Query()&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;span&gt;&lt;font face="Verdana"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;When I run this script I get the error: &amp;ldquo;oXMLDocument.selectSingleNode(&amp;hellip;)&amp;rsquo; is null or not an object&amp;rdquo;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;What am I doing wrong??&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;Kind regards,&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span&gt;&lt;font face="Verdana"&gt;Erik&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;</description></item></channel></rss>