<?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: Set the value of a field to a view name</title><link>https://www.infopathdev.com:443/forums/thread/29611.aspx</link><pubDate>Mon, 23 Jun 2008 14:18:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:29611</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/29611.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=29611</wfw:commentRss><description>&lt;p&gt;The code in my first post is C#. The function you have mentioned is jscript. For jscript, the code would be:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;var viewName = XDocument.View.Name; &lt;br /&gt;var field = XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:field1&amp;quot;); &lt;br /&gt;field.text = viewName;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;This can go in your switch view event and will display the name of the view in field 1.&lt;/p&gt;</description></item><item><title>Re: Set the value of a field to a view name</title><link>https://www.infopathdev.com:443/forums/thread/29603.aspx</link><pubDate>Mon, 23 Jun 2008 09:26:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:29603</guid><dc:creator>stuck</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/29603.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=29603</wfw:commentRss><description>&lt;p&gt;thanks, does that code go in the &lt;strong&gt;function&lt;/strong&gt; &lt;strong&gt;XDocument::OnSwitchView(eventObj)&lt;/strong&gt; bit?&lt;/p&gt;
&lt;p&gt;All I&amp;#39;m really trying to do is force mandatory fields on my views.&lt;/p&gt;</description></item><item><title>Re: Set the value of a field to a view name</title><link>https://www.infopathdev.com:443/forums/thread/29564.aspx</link><pubDate>Sat, 21 Jun 2008 03:19:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:29564</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/29564.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=29564</wfw:commentRss><description>&lt;p&gt;Hi:&lt;/p&gt;
&lt;p&gt;Are you comfortable using code for this? In IP 2007, you can add the following to the View Switched event (C#):&lt;/p&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; xpath = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/my:myFields/my:field1&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; field = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field.SetValue(&lt;/font&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;.CurrentView.ViewInfo.Name);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;With the string for the variable xpath set to the node you want the value of the view in. I don&amp;#39;t know what effect (if any)&amp;nbsp;the other software you are running will have -- I would imagine that the View Switched event will be called&amp;nbsp; whether the view is changed by a user or by an application.&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Set the value of a field to a view name</title><link>https://www.infopathdev.com:443/forums/thread/29364.aspx</link><pubDate>Thu, 12 Jun 2008 16:08:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:29364</guid><dc:creator>stuck</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/29364.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=29364</wfw:commentRss><description>&lt;p&gt;none of my views have any buttons that changes the view. The view changing bit is taken care of anohter software that is embeded in our wss....&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve been stuck on this for a long time now..&lt;/p&gt;</description></item><item><title>Re: Set the value of a field to a view name</title><link>https://www.infopathdev.com:443/forums/thread/28869.aspx</link><pubDate>Thu, 22 May 2008 14:34:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:28869</guid><dc:creator>Clay Fox</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/28869.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=28869</wfw:commentRss><description>&lt;p&gt;I do not think there is a way.&lt;/p&gt;
&lt;p&gt;I do this frequently but set the filed to the default view name. And then on every button where the view is changed also update the field. You cnanot let them switch from the toolbar but that is rarely a requirement anyway.&lt;/p&gt;</description></item><item><title>Set the value of a field to a view name</title><link>https://www.infopathdev.com:443/forums/thread/28866.aspx</link><pubDate>Thu, 22 May 2008 10:51:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:28866</guid><dc:creator>stuck</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/28866.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=28866</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;how can I set a fields value to the name of the active view?&lt;/p&gt;
&lt;p&gt;so basically everytime a view is opened, I want a field to inherit the view name as its value.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item></channel></rss>