<?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: Using the button control to launch a web page</title><link>https://www.infopathdev.com:443/forums/thread/71752.aspx</link><pubDate>Fri, 04 Nov 2011 04:30:23 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:71752</guid><dc:creator>RoseMary</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/71752.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=71752</wfw:commentRss><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am using Infopath 2007 and it is not browser enabled. &lt;/p&gt;
&lt;p&gt;My requirement is to open a web page like &lt;a href="http://www.google.com/"&gt;http://www.google.com&lt;/a&gt; on the button click and it should also close the existing form(i know closing form can be achieved using rules). Please help for redirection&lt;/p&gt;
&lt;p&gt;I tried the suggestion which was provided&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Application.XmlForms.Open(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;http://www.google.com&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;);&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;&amp;nbsp;but i got the below error.&lt;/p&gt;
&lt;p&gt;/Error - Start&amp;nbsp;&lt;/p&gt;
&lt;p&gt;System.Runtime.InteropServices.COMException&lt;br /&gt;InfoPath cannot open the following file: &lt;a href="http://www.google.com/"&gt;http://www.google.com&lt;/a&gt;.&lt;br /&gt;The form is attempting to redirect itself to a different and potentially unsafe location.&lt;/p&gt;
&lt;p&gt;The form is accessed through a redirection from different domain, which is not allowed. If you want to open this form, copy it to a location within your security domain.&lt;br /&gt;Access is denied.&lt;/p&gt;
&lt;p&gt;/Error - End&lt;/p&gt;</description></item><item><title>Re: Using the button control to launch a web page</title><link>https://www.infopathdev.com:443/forums/thread/70511.aspx</link><pubDate>Thu, 22 Sep 2011 01:45:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:70511</guid><dc:creator>gdgonzal</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/70511.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=70511</wfw:commentRss><description>&lt;p&gt;This code doesn&amp;#39;t work.&amp;nbsp; When my form loads I get &amp;quot;InfoPath cannot open the selected form&amp;quot; error.&amp;nbsp; Any other suggestions?&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Using the button control to launch a web page</title><link>https://www.infopathdev.com:443/forums/thread/38888.aspx</link><pubDate>Wed, 25 Feb 2009 05:23:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38888</guid><dc:creator>breakfix</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38888.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38888</wfw:commentRss><description>&lt;p&gt;This code here will launch a new&amp;nbsp;internet explorer window to&amp;nbsp;the URL you specify.&amp;nbsp; It&amp;#39;s an Activex control so you&amp;#39;ll need to have that allowed or prompt you to allow it to run in the browser&lt;/p&gt;
&lt;p&gt;&amp;nbsp;function CTRL2_17::OnClick(eventObj) &lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp;var sh=new ActiveXObject(&amp;quot;Wscript.Shell&amp;quot;); &lt;/p&gt;
&lt;p&gt;sh.Run(&amp;quot;iexplore.exe&amp;quot;+&amp;quot; &amp;quot;+&lt;a href="http://yoursite.here/"&gt;http://yoursite.here&lt;/a&gt;); &lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;thanks Shiva for your input.&amp;nbsp; I think this is what we&amp;#39;re looking for here.&lt;/p&gt;</description></item><item><title>Re: Using the button control to launch a web page</title><link>https://www.infopathdev.com:443/forums/thread/38745.aspx</link><pubDate>Sat, 21 Feb 2009 04:39:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38745</guid><dc:creator>gdgonzal</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38745.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38745</wfw:commentRss><description>&lt;p&gt;I checked out the link...what does this mean exactly?&amp;nbsp; I am not sure I understand...could you just provide us an example of the syntax that would work?&amp;nbsp; I to get the &amp;quot;window is undefined&amp;quot; error and after reading the link you referenced I am not sure I comprehend the relevance, can you please clarify?&lt;/p&gt;</description></item><item><title>Re: Using the button control to launch a web page</title><link>https://www.infopathdev.com:443/forums/thread/38336.aspx</link><pubDate>Wed, 11 Feb 2009 18:56:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38336</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38336.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38336</wfw:commentRss><description>&lt;p&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;Hello,&lt;/span&gt;&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;mso-ansi-language:EN;"&gt;Check out this link,&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;mso-ansi-language:EN;"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;mso-ansi-language:EN;"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;mso-ansi-language:EN;"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms535246(VS.85).aspx"&gt;&lt;span style="COLOR:windowtext;"&gt;http://msdn.microsoft.com/en-us/library/ms535246(VS.85).aspx&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;/span&gt; 
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Using the button control to launch a web page</title><link>https://www.infopathdev.com:443/forums/thread/38283.aspx</link><pubDate>Tue, 10 Feb 2009 18:39:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38283</guid><dc:creator>breakfix</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38283.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38283</wfw:commentRss><description>&lt;p&gt;Did anybody get this working?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I&amp;#39;ve tried the code above as follows:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;function CTRL2_17::OnClick(eventObj) &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;window.external.ExecuteFile(&amp;quot;URLofthesite&amp;quot;); &lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;The form will load but clicking on this button returns the error that &amp;#39;window&amp;#39; is undefined &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Using the button control to launch a web page</title><link>https://www.infopathdev.com:443/forums/thread/34777.aspx</link><pubDate>Mon, 24 Nov 2008 07:10:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:34777</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/34777.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=34777</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The above code is in C#. After you debug and your error on script.js? Are you using same code in jscript file?&lt;/p&gt;
&lt;p&gt;If you want to open the form using jscript code then use below the code,&lt;/p&gt;
&lt;p&gt;window.external.ExecuteFile(&amp;quot;&lt;a href="http://nummdp01/sites/BusinessPortal/Lists/Business%20Portal%20Feedback/AllItems.aspx"&gt;http://nummdp01/sites/BusinessPortal/Lists/Business%20Portal%20Feedback/AllItems.aspx&lt;/a&gt;&amp;quot;);&lt;/p&gt;
&lt;p&gt;Note: Make sure that the above URL of the form it will open in Internet Explorer without giving any error message.&lt;/p&gt;</description></item><item><title>Re: Using the button control to launch a web page</title><link>https://www.infopathdev.com:443/forums/thread/34462.aspx</link><pubDate>Tue, 18 Nov 2008 19:58:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:34462</guid><dc:creator>Almeida5860</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/34462.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=34462</wfw:commentRss><description>&lt;p&gt;Hi, Shiva! Thanks so much for your help and patience. I should clarify that we&amp;#39;re using InfoPath 2003. So, I plugged in the code as follows in Microsoft Script Editor for this button control in the InfoPath form...&lt;/p&gt;
&lt;p&gt;function CTRL84_8::OnClick(eventObj)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Write your code here&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Application.XmlForms.Open(&amp;quot;&lt;a href="http://nummdp01/sites/BusinessPortal/Lists/Business%20Portal%20Feedback/AllItems.aspx"&gt;http://nummdp01/sites/BusinessPortal/Lists/Business%20Portal%20Feedback/AllItems.aspx&lt;/a&gt;&amp;quot;);&lt;/p&gt;
&lt;p&gt;}&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In InfoPath&amp;nbsp;Preview mode, I received the following error message when I pressed the button...&lt;/p&gt;
&lt;p&gt;&amp;quot;A&amp;nbsp;run-time error has occurred.&lt;/p&gt;
&lt;p&gt;Do you want to debug?&lt;/p&gt;
&lt;p&gt;The following error occurred:&lt;/p&gt;
&lt;p&gt;&amp;#39;this.Application.XmlForms&amp;#39; is null or not an object&lt;/p&gt;
&lt;p&gt;File:script.js&lt;/p&gt;
&lt;p&gt;Line:37&amp;quot;&lt;/p&gt;</description></item><item><title>Re: Using the button control to launch a web page</title><link>https://www.infopathdev.com:443/forums/thread/34366.aspx</link><pubDate>Mon, 17 Nov 2008 16:25:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:34366</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/34366.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=34366</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Before passing the complete&amp;nbsp;URL to below the code as Anuma given above to you and&amp;nbsp;check once that url is opened in IE page.&lt;/p&gt;
&lt;p&gt;this.Application.XmlForms.Open(&amp;quot;URL of the Form&amp;quot;);&lt;/p&gt;</description></item><item><title>Re: Using the button control to launch a web page</title><link>https://www.infopathdev.com:443/forums/thread/34357.aspx</link><pubDate>Mon, 17 Nov 2008 15:14:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:34357</guid><dc:creator>Anuma</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/34357.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=34357</wfw:commentRss><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Try this: &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;this.Application.XmlForms.Open(templatefilename);&lt;/strong&gt;&amp;nbsp;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Application.Xdocuments doesn&amp;#39;t exist in forms with the 2007 object model.&lt;/p&gt;</description></item><item><title>Re: Using the button control to launch a web page</title><link>https://www.infopathdev.com:443/forums/thread/34356.aspx</link><pubDate>Mon, 17 Nov 2008 14:59:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:34356</guid><dc:creator>Almeida5860</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/34356.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=34356</wfw:commentRss><description>&lt;p&gt;Thanks, Shiva. I tried your suggestion, but got an &amp;quot;InfoPath cannot open the selected form.&amp;quot; Let me just clarify what I&amp;#39;m doing. I have an InfoPath form named Project Status. In this form I&amp;#39;ve added a button control in the form named View Financial Data. Theoretically, when someone presses this button, an html page (&lt;a href="http://nummdp01/Sites/BusinessPortal/Financial%20Summary.htm)"&gt;http://nummdp01/Sites/BusinessPortal/Financial%20Summary.htm)&lt;/a&gt;&amp;nbsp;opens up in a separate window. This is because&amp;nbsp;the Project Status form contains status information for the given project, but the financial information is found in a separate&amp;nbsp;place (webpage). &lt;/p&gt;
&lt;p&gt;So, based on the information you provided, I double-clicked on the button in the form to open it for edit and then clicked on the Edit Form Code... In&amp;nbsp;Microsoft Script Editor, the following information was present (I&amp;#39;ve excluded the&amp;nbsp;non-essential comments)...then plugged in the URL I&amp;nbsp;need to launch in the &amp;#39;function CTRL84_8::OnClick(eventObj)&amp;#39;. I presume this is the function that handles the depressing of the button.&lt;/p&gt;
&lt;p&gt;//general comments...&lt;/p&gt;
&lt;p&gt;XDocument.DOM.SetProperty (&amp;quot;SelectionNamespaces&amp;quot;, &amp;#39;xmlns:x....&amp;quot;)&lt;/p&gt;
&lt;p&gt;//&amp;lt;/namespacesDefinition&amp;gt;&lt;/p&gt;
&lt;p&gt;//general comments...&lt;/p&gt;
&lt;p&gt;function XDocument::OnLoad(eventObj)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Write your code here&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;//more comments&lt;/p&gt;
&lt;p&gt;function CTRL84_8::OnClick(eventObj)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Write your code here&lt;/p&gt;
&lt;p&gt;Application.XDocuments.Open(&amp;lt;&lt;a href="http://nummdp01/Sites/BusinessPortal/Financial%20Summary.htm)"&gt;http://nummdp01/Sites/BusinessPortal/Financial%20Summary.htm&lt;/a&gt;&amp;gt;)&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;What am I doing wrong? Again thanks for help.&lt;/p&gt;</description></item><item><title>Re: Using the button control to launch a web page</title><link>https://www.infopathdev.com:443/forums/thread/34305.aspx</link><pubDate>Sat, 15 Nov 2008 02:49:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:34305</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/34305.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=34305</wfw:commentRss><description>&lt;p&gt;Hello Welcome to the Forum,&lt;/p&gt;
&lt;p&gt;You can open using the below code to open the form,&lt;/p&gt;
&lt;p&gt;Application.XDocuments.Open(&amp;lt;Url of the form&amp;gt;);&lt;/p&gt;
&lt;p&gt;If you set any hyperlink to one field then get the value and pass that value to open the form.&lt;/p&gt;</description></item><item><title>Using the button control to launch a web page</title><link>https://www.infopathdev.com:443/forums/thread/34302.aspx</link><pubDate>Fri, 14 Nov 2008 22:05:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:34302</guid><dc:creator>Almeida5860</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/34302.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=34302</wfw:commentRss><description>&lt;p&gt;I need to launch a web page from within an InfoPath form. I could use the Hyperlink control in InfoPath, but I have a need to&amp;nbsp;launch it using the button control. In looking at the options for the button control, the only way to do this, if at all,&amp;nbsp;is to use the Action, Rules and Custom Code, and plug in the hyperlink to the web page I want to launch in the Edit Form Code... section.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m don&amp;#39;t know JS, so I&amp;#39;m hoping that if this is possible someone would provide a sample&amp;nbsp;code that I can&amp;nbsp;include in the Edit Form Code... section. Many thanks in advance for your help.&lt;/p&gt;
&lt;p&gt;G&lt;/p&gt;</description></item></channel></rss>