<?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>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: InfoPath form and User login</title><link>https://www.infopathdev.com:443/forums/thread/20045.aspx</link><pubDate>Thu, 17 May 2007 21:16:20 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20045</guid><dc:creator>Clay Fox</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20045.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=20045</wfw:commentRss><description>&lt;p&gt;Ok, I looked up the issue I had remembered with the onload event, you can&amp;#39;t switch views. However the work around is to change the default view. Greg explains it here. &lt;a href="http://www.infopathdev.com/blogs/greg/archive/2005/06/27/Switch-Views-During-the-OnLoad-Event.aspx"&gt;http://www.infopathdev.com/blogs/greg/archive/2005/06/27/Switch-Views-During-the-OnLoad-Event.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;For your second issue you might add this to your logic and look first if it is a new form and then if not check the allowform before setting the default view.&lt;/p&gt;&lt;p&gt;Otherwise what I have done, is not use code and the onload event but instead done everything in the opening rules. I have used SharePoint or a datasource to get the username.&amp;nbsp; I have used existing data in the form to determine whether it is new or an existing form.&lt;/p&gt;&lt;p&gt;Have fun.&lt;/p&gt;</description></item><item><title>Re: InfoPath form and User login</title><link>https://www.infopathdev.com:443/forums/thread/20043.aspx</link><pubDate>Thu, 17 May 2007 20:56:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20043</guid><dc:creator>liorlankril</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20043.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=20043</wfw:commentRss><description>&lt;p&gt;Hi Clay Fox. I will explain my problem exactly&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div class="ForumPostContentText" id="ctl00_ctl01_bcr_ctl00___PostRepeater_ctl01_PostViewWrapper"&gt;&lt;p&gt;I have an InfoPath Form that contain field (on main Data Source) named &amp;quot;UserLogin&amp;quot;.&lt;/p&gt;&lt;p&gt;&amp;nbsp;On it&amp;#39;s OnLoad event I do this code:&lt;/p&gt;&lt;p&gt;function XDocument::OnLoad(eventObj) &lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;&amp;nbsp;var objNetwork = new ActiveXObject(&amp;quot;WScript.network&amp;quot;);&lt;/p&gt;&lt;p&gt;&amp;nbsp;var login=objNetwork.UserName ; &lt;/p&gt;&lt;p&gt;if(XDocument.IsNew)&lt;/p&gt;&lt;p&gt;&amp;nbsp;{ &lt;/p&gt;&lt;p&gt;XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:UserLogin&amp;quot;).text=login; // Set the current user login as the value of &amp;quot;UserLogin&amp;quot;&lt;/p&gt;&lt;p&gt;} &lt;/p&gt;&lt;p&gt;else&amp;nbsp; // NOT NEW FORM&lt;/p&gt;&lt;p&gt;&amp;nbsp;{&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var existLogin=XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:UserLogin&amp;quot;).text;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (existLogin != login)&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//This is the problematic part !!!!!!!!!!!!!!!!!!!!!!!!!!&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;}&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Explain: If the form is new form I update on the &amp;quot;UserLogin&amp;quot; field to be the value of the user login that open this form.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;If the form is NOT NEW&lt;/strong&gt; - I check if the current user that open the form, is the same user that open it on the first time!!!!!!&lt;/p&gt;&lt;p&gt;&amp;nbsp;If not (the problematic part)..... I want to close the form or switch view but as I can see I cant do those operations on the OnLoad event!!!!!!&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;What can I do?&lt;/p&gt;&lt;p&gt;By the way I also try this: I add to my Data Source a boolean field called &amp;quot;AllowForm&amp;quot; (deafult value=True)&lt;/p&gt;&lt;p&gt;In me code - In the (the problematic part) I write this:&lt;/p&gt;&lt;p&gt;if (existLogin != login) { XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:AllowForm&amp;quot;).text=False; }&lt;/p&gt;&lt;p&gt;And the I go to Tools-&amp;gt; Form Options-&amp;gt; Open and Save -&amp;gt; Rules -&amp;gt; Add -&amp;gt; Set condition: &amp;quot;&lt;strong&gt;if AllowForm is equal&amp;nbsp;to&amp;nbsp;False&lt;/strong&gt;&amp;quot; -&amp;gt; Add action -&amp;gt; Switch to &amp;quot;View 2&amp;quot;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;It&amp;#39;s not work because this open role happen &lt;strong&gt;before &lt;/strong&gt;the OnLoad event so I AllowForm still =True!!!! and the action not operate!!!!&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Any Ideas????&lt;/p&gt;&lt;/div&gt;</description></item><item><title>Re: InfoPath form and User login</title><link>https://www.infopathdev.com:443/forums/thread/20028.aspx</link><pubDate>Thu, 17 May 2007 06:30:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20028</guid><dc:creator>Clay Fox</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20028.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=20028</wfw:commentRss><description>I have done this several times, screened the user and then switched to the appropriate view as the form opens, overriding the default view.&amp;nbsp; However I have always done this with the opening rules.&amp;nbsp; I seem to remember something about that the view cannot be switched in the onload event.&amp;nbsp; It has to happen after load, as the opening rules are being executed.</description></item><item><title>InfoPath form and User login</title><link>https://www.infopathdev.com:443/forums/thread/20026.aspx</link><pubDate>Thu, 17 May 2007 06:05:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20026</guid><dc:creator>liorlankril</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20026.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=20026</wfw:commentRss><description>&lt;p&gt;I want to do this:&lt;/p&gt;&lt;p&gt;I want to&amp;nbsp; create an InfoPath form that when it opened the first time (isNew=true) it will remember the user login (stored it in a field) and then when someone will try to open this form, it will check if is&amp;nbsp; the same user that opened it on the first time..... If not... I want to close the form or to switch to other view (I try yo do this from the OnLoad event but I cam&amp;#39;t do this)&lt;/p&gt;</description></item></channel></rss>