<?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>Views</title><link>https://www.infopathdev.com:443/forums/42.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: [solved] Switch view so email displays 'custom view' then switch back after send [solved]</title><link>https://www.infopathdev.com:443/forums/thread/100083.aspx</link><pubDate>Mon, 17 Nov 2014 08:09:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:100083</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/100083.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=42&amp;PostID=100083</wfw:commentRss><description>&lt;p&gt;Hi AmberArcher77!&lt;/p&gt;&lt;p&gt;Welcome&amp;nbsp;and thank you for posting.&lt;/p&gt;&lt;p&gt;You are replying to an old thread. We don&amp;#39;t have intel about Skarn&amp;#39;s methodology, but we would be happy to help you.&lt;/p&gt;&lt;p&gt;Please email support (at) qdabra (dot) com&amp;nbsp;if you would like to figure this out.&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;P&lt;/p&gt;</description></item><item><title>Re: [solved] Switch view so email displays 'custom view' then switch back after send [solved]</title><link>https://www.infopathdev.com:443/forums/thread/100051.aspx</link><pubDate>Thu, 13 Nov 2014 20:21:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:100051</guid><dc:creator>AmberArcher77</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/100051.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=42&amp;PostID=100051</wfw:commentRss><description>&lt;p&gt;Where do I insert this code in order to make it work?&amp;nbsp; I want a user to submit the form to a group via email and that form switch views so the recipient of the email sees only the correct view.&amp;nbsp; Thanks in advance!&lt;/p&gt;</description></item><item><title>[solved] Switch view so email displays 'custom view' then switch back after send [solved]</title><link>https://www.infopathdev.com:443/forums/thread/97798.aspx</link><pubDate>Thu, 05 Jun 2014 08:47:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:97798</guid><dc:creator>Skarn</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/97798.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=42&amp;PostID=97798</wfw:commentRss><description>&lt;p&gt;You may be aware of the &amp;#39;switch view before email, then email is blank&amp;#39; issue.&lt;br /&gt;You may also know of issues trying to switch views then switch back again - this method could help with that too.&lt;br /&gt;If you *must* have this sort of feature, I give you a template and code work around - it&amp;#39;s not a &amp;#39;simple&amp;#39; solution, but it does work, and quite flawlessly from what I can determine.&lt;/p&gt;
&lt;p&gt;There&amp;#39;s possibly ways to refine this, but most importantly - &lt;strong&gt;proof of concept&lt;/strong&gt;!&lt;br /&gt;Attached is a minimal template, and code seperately - please do what you know you have to - design mode, copy in the code, republish etc.&lt;/p&gt;
&lt;p&gt;&lt;u&gt;Summary of method:&lt;/u&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;Button to submit - runs code in event&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Code sets a global variable with a &amp;#39;command&amp;#39; for the &amp;#39;View change event&amp;#39; to use.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Code sets form field - contextTrap - to current View&amp;#39;s name (for returning to later)&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Code switches view to the one wanted to display in email&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;View change event picks up the change&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;View change code checks the &amp;#39;command&amp;#39; and performs function - in this case, email submit&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;View change code sets the &amp;#39;command&amp;#39; back to empty string (so we don&amp;#39;t run the command again during the switch back)&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Here&amp;#39;s the trick - normally we&amp;#39;ve&amp;nbsp;tried to switch the View immediately back in the same &amp;#39;code path&amp;#39;&amp;nbsp;- but Infopath won&amp;#39;t let us switch views BEFORE the last view change has rendered and the last &amp;#39;View change event&amp;#39; has finished.&lt;br /&gt;&lt;br /&gt;By putting a text box control, bound to the my:contextTrap field AT THE VERY TOP of the &amp;#39;Email Print View&amp;#39;, AFTER the first view change event completes Infopath sets focus to this control as the first one in the view. We take advantage of that and:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;FormEvents_ContextChanged event fires&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Code checks if it&amp;#39;s the &amp;#39;my:contextTrap&amp;#39; field&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Code reads the value of my:contextTrap to get the name of the view to return to&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;
&lt;div&gt;Code switches view back to the previous one&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Code sets my:contextTrap to empty string (ready for next time)&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Infopath lets us do this now because the last view completed its render and the last view change event completed.&lt;br /&gt;Of course, the view change event fires again, but we have checks to make sure there are no infinite loops.&lt;/p&gt;
&lt;p&gt;Sorry if this has come up as a method before, but as far as I know, this is the first time a solution has been presented.&lt;br /&gt;If you can do this better - please tell us/me how. &lt;/p&gt;
&lt;p&gt;Skarn.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>