<?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: Role based view switch does not run OnLoad code</title><link>https://www.infopathdev.com:443/forums/thread/22752.aspx</link><pubDate>Wed, 29 Aug 2007 16:59:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22752</guid><dc:creator>brandtsmith</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22752.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22752</wfw:commentRss><description>&lt;p&gt;nope...I&amp;#39;m developing on IP2007...other users are using IP2003...the execution stops when it executes &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;eventObj.XDocument.InputParameters[&amp;quot;CourseID&amp;quot;].Value&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Role based view switch does not run OnLoad code</title><link>https://www.infopathdev.com:443/forums/thread/22751.aspx</link><pubDate>Wed, 29 Aug 2007 16:45:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22751</guid><dc:creator>brandtsmith</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22751.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22751</wfw:commentRss><description>&lt;p&gt;Apparently it has something to do with the Active Directory Security Group that the user is a membr of...not the Role in IP...I just encountered another example where I have a IP form that grabs an input parameter passed to it to get started...it absolutely will not run the OnLoad code if the js statement in boldface is present...when I comment it out it runs fine&lt;br /&gt;The user&amp;#39;s security group is only User...member of Domain Users....admins seem to work fine?...&lt;/p&gt;
&lt;p&gt;function XDocument::OnLoad(eventObj) &lt;br /&gt;{ &lt;br /&gt;// Write your code here &lt;br /&gt;&lt;strong&gt;&lt;br /&gt;var wVar = eventObj.XDocument.InputParameters[&amp;quot;CourseID&amp;quot;].Value; &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;wVar = 25 &lt;br /&gt;eventObj.XDocument.UI.Alert(&amp;quot;CourseID = &amp;quot; + wVar); &lt;br /&gt;&lt;br /&gt;// Get the DOM for the Seconday Data Source &lt;br /&gt;var dat = XDocument.DataObjects(&amp;quot;GetCourseInfo&amp;quot;).DOM; &lt;br /&gt;dat.setProperty(&amp;quot;SelectionNamespaces&amp;quot;, &amp;#39;xmlns:sqlsoaptypes=&amp;quot;http://schemas.microsoft.com/sqlserver/2004/SOAP/types&amp;quot; xmlns:sqltypes=&amp;quot;http://schemas.microsoft.com/sqlserver/2004/sqltypes&amp;quot; xmlns:s0=&amp;quot;http://tempuri.org&amp;quot; xmlns:dfs=&amp;quot;http://schemas.microsoft.com/office/infopath/2003/dataFormSolution&amp;quot; xmlns:ns1=&amp;quot;urn:schemas-microsoft-com:sql:SqlRowSet1&amp;quot; xmlns:my=&amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-08-16T13:30:52&amp;quot;&amp;#39;); &lt;br /&gt;var xpath = &amp;quot;/dfs:myFields/dfs:queryFields/s0:GetCourseInfo/s0:CourseID&amp;quot;; &lt;br /&gt;XDocument.GetDOM(&amp;quot;GetCourseInfo&amp;quot;).selectSingleNode(xpath).text = wVar; &lt;br /&gt;XDocument.DataObjects(&amp;quot;GetCourseInfo&amp;quot;).Query();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;</description></item><item><title>Re: Role based view switch does not run OnLoad code</title><link>https://www.infopathdev.com:443/forums/thread/22647.aspx</link><pubDate>Sat, 25 Aug 2007 04:46:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22647</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22647.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22647</wfw:commentRss><description>&lt;p&gt;If you can send me the XSN then I can try and investigate a little bit.&lt;/p&gt;</description></item><item><title>Re: Role based view switch does not run OnLoad code</title><link>https://www.infopathdev.com:443/forums/thread/22638.aspx</link><pubDate>Fri, 24 Aug 2007 15:44:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22638</guid><dc:creator>brandtsmith</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22638.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22638</wfw:commentRss><description>&lt;p&gt;thats what I am saying...the OnLoad code does not run...wondering why?&lt;/p&gt;</description></item><item><title>Re: Role based view switch does not run OnLoad code</title><link>https://www.infopathdev.com:443/forums/thread/22597.aspx</link><pubDate>Thu, 23 Aug 2007 16:07:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22597</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22597.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22597</wfw:commentRss><description>&lt;p&gt;If you are using rules then Onload code should run with out fail. &lt;/p&gt;
&lt;p&gt;Anyway you can set view in the onload and try out.&lt;/p&gt;</description></item><item><title>Re: Role based view switch does not run OnLoad code</title><link>https://www.infopathdev.com:443/forums/thread/22595.aspx</link><pubDate>Thu, 23 Aug 2007 15:51:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22595</guid><dc:creator>brandtsmith</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22595.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22595</wfw:commentRss><description>&lt;p&gt;??? I&amp;#39;m not setting the view using code...it&amp;#39;s done in rules...&lt;/p&gt;
&lt;p&gt;are you saying to put XDocument.ViewInfos[&amp;lt;viewName&amp;gt;].IsDefault = true; in the OnLoad event???&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I just want the OnLoad to run regardless of which view is loaded...again that is controlled by Roles and Rules&lt;/p&gt;</description></item><item><title>Re: Role based view switch does not run OnLoad code</title><link>https://www.infopathdev.com:443/forums/thread/22593.aspx</link><pubDate>Thu, 23 Aug 2007 15:43:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22593</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22593.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22593</wfw:commentRss><description>&lt;p&gt;OnLoad View object is not created so you will get an exception if you try to use it. OnLoad to a set a view as default you need to use the following statement, replace &amp;quot;&amp;lt;viewName&amp;gt;&amp;quot; with your view name.&lt;/p&gt;
&lt;p&gt;XDocument.ViewInfos[&amp;lt;viewName&amp;gt;].IsDefault = true;&lt;/p&gt;</description></item><item><title>Role based view switch does not run OnLoad code</title><link>https://www.infopathdev.com:443/forums/thread/22590.aspx</link><pubDate>Thu, 23 Aug 2007 15:31:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22590</guid><dc:creator>brandtsmith</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22590.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22590</wfw:commentRss><description>&lt;p&gt;I have a form that allows the user to click a btn and open another form...form2 is passed an input parameter (base don a field value in form1) and runs a sp via a webservice to refresh some secondary data...this happens during the OnLoad event...works fine&lt;/p&gt;
&lt;p&gt;Problem is that when I aplied role based logic to the form (Open form2 in a ReadOnly view for certain users) it apparently bypasses the OnLoad code...and therefore my secondary data source never updates...the ReadOnly view is NOT the default view.&lt;/p&gt;
&lt;p&gt;2 Roles : Reader (default) &amp;amp; Contributor&lt;/p&gt;
&lt;p&gt;Rule on open is to switch to ReadOnly view if users are in Reader role&lt;/p&gt;
&lt;p&gt;function XDocument::OnLoad(eventObj) &lt;br /&gt;{ &lt;br /&gt;// Write your code here &lt;br /&gt;// Get the Input value&lt;br /&gt;var wVar = eventObj.XDocument.InputParameters[&amp;quot;CourseID&amp;quot;].Value; &lt;br /&gt;eventObj.XDocument.UI.Alert(&amp;quot;CourseID = &amp;quot; + wVar); &lt;br /&gt;&lt;br /&gt;// Get the DOM for the Seconday Data Source &lt;br /&gt;var dat = XDocument.DataObjects(&amp;quot;GetCourseInfo&amp;quot;).DOM; &lt;br /&gt;dat.setProperty(&amp;quot;SelectionNamespaces&amp;quot;, &amp;#39;xmlns:sqlsoaptypes=&amp;quot;http://schemas.microsoft.com/sqlserver/2004/SOAP/types&amp;quot; xmlns:sqltypes=&amp;quot;http://schemas.microsoft.com/sqlserver/2004/sqltypes&amp;quot; xmlns:s0=&amp;quot;http://tempuri.org&amp;quot; xmlns:dfs=&amp;quot;http://schemas.microsoft.com/office/infopath/2003/dataFormSolution&amp;quot; xmlns:ns1=&amp;quot;urn:schemas-microsoft-com:sql:SqlRowSet1&amp;quot; xmlns:my=&amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-08-16T13:30:52&amp;quot;&amp;#39;); &lt;br /&gt;&lt;br /&gt;var xpath = &amp;quot;/dfs:myFields/dfs:queryFields/s0:GetCourseInfo/s0:CourseID&amp;quot;; &lt;br /&gt;XDocument.GetDOM(&amp;quot;GetCourseInfo&amp;quot;).selectSingleNode(xpath).text = wVar; &lt;br /&gt;XDocument.DataObjects(&amp;quot;GetCourseInfo&amp;quot;).Query(); &lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>