<?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: Call code from a rule...?</title><link>https://www.infopathdev.com:443/forums/thread/8994.aspx</link><pubDate>Mon, 20 Feb 2006 07:11:42 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:8994</guid><dc:creator>nukkumatti</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/8994.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=8994</wfw:commentRss><description>Hi I could also think about another solution haven't tried it an am not sure if it works though.&lt;br /&gt;&lt;br /&gt;For your drop downlist use "Look up values in a data connection, webservice, file or sharepoint library or list" for the Listbox entries. At first you need to create an XML file as your datasource with the listbox entries you require. That is quite easy with Infopath. Check out this thread to get what I mean: (thx to MFaus again)&lt;a href='http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=1258&lt;br /&gt;' target='_blank' title='http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=1258&lt;br /&gt;'&lt;a target="_blank" href=http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=1258&gt;http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=1258&lt;/a&gt;&lt;br /&gt;&lt;/a&gt;.&lt;br /&gt;Then put a textbox into your form (can also be a hidden one) and use code like this in the OnAfterChange of the DDL to put the selected "text/view"  string into the textbox:&lt;br /&gt;&lt;pre&gt;#region DropDownList event Handlers/ write selected string into textboxes&lt;br /&gt;		// The following function handler is created by Microsoft Office InfoPath. Do not&lt;br /&gt;		// modify the type or number of arguments.&lt;br /&gt;		[InfoPathEventHandler(MatchPath="/my:myFields/my:secMainSection/my:ddlRegion", EventType=InfoPathEventType.OnAfterChange)]&lt;br /&gt;		public void ddlRegion_OnAfterChange(DataDOMEvent e)&lt;br /&gt;		{&lt;br /&gt;			// Write code here to restore the global state.&lt;br /&gt;&lt;br /&gt;			&lt;br /&gt;			if (e.IsUndoRedo)&lt;br /&gt;			{&lt;br /&gt;				// An undo or redo operation has occurred and the DOM is read-only.&lt;br /&gt;				return;&lt;br /&gt;			}&lt;br /&gt;&lt;br /&gt;			// A field change has occurred and the DOM is writable. Write code here to respond&lt;br /&gt;			// to the changes.&lt;br /&gt;			string val						=	e.Source.text;&lt;br /&gt;			IXMLDOMNode nodeRegion			=	thisXDocument.DOM.selectSingleNode("my:myFields/my:tbHiddenRegions");&lt;br /&gt;			nodeRegion.text					=	val;&lt;br /&gt;		}&lt;/pre&gt;.&lt;br /&gt;&lt;br /&gt;Then in the OnAfterChangeEvent of the textbox use the earlier mentioned SwitchView method maybe with some "if/or switch case" help to check what string is in the textbox. Hope this is understandable a least a bit.&lt;br /&gt;May be Matt can confirm wether or not it is possible like this.&lt;br /&gt;Good luck.&lt;br /&gt;&lt;br /&gt;Listen to Motörhead cos they play Rock'n Roll :)</description></item><item><title>Re: Call code from a rule...?</title><link>https://www.infopathdev.com:443/forums/thread/8993.aspx</link><pubDate>Sat, 18 Feb 2006 00:05:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:8993</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/8993.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=8993</wfw:commentRss><description>After doing some investigation I don't think it's possible to change the view upon changing the value of a drop-down list. I think the best you will be able to do is display all of the views in a drop-down list, and a GO button next to the drop-down. The user can select the view from the drop-down list and then click the GO button the switch to that view.&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;InfoPath Dev Texas&lt;br /&gt;</description></item><item><title>Re: Call code from a rule...?</title><link>https://www.infopathdev.com:443/forums/thread/8992.aspx</link><pubDate>Tue, 07 Feb 2006 23:36:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:8992</guid><dc:creator>vt_asparagus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/8992.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=8992</wfw:commentRss><description>Thanks Matt...with a little trickery you can do anything...J</description></item><item><title>Re: Call code from a rule...?</title><link>https://www.infopathdev.com:443/forums/thread/8991.aspx</link><pubDate>Tue, 07 Feb 2006 22:39:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:8991</guid><dc:creator>Karsten Brocksieper</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/8991.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=8991</wfw:commentRss><description>Hello Matt,&lt;br /&gt;&lt;br /&gt;thank you for your tip regarding the "OnAfterChange" event which I haven´t knew by now but unfortunately I got the following error after I changed my selection in the drop-down list:&lt;br /&gt;&lt;br /&gt;"Invalid context for OM call Infopath"&lt;br /&gt;&lt;br /&gt;Do you know how I can avoid this error.&lt;br /&gt;&lt;br /&gt;Thanks for your help&lt;br /&gt;&lt;br /&gt;Karsten</description></item><item><title>Re: Call code from a rule...?</title><link>https://www.infopathdev.com:443/forums/thread/8990.aspx</link><pubDate>Tue, 07 Feb 2006 19:18:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:8990</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/8990.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=8990</wfw:commentRss><description>Jason, check out this page:&lt;a target="_blank" href=http://blogs.msdn.com/infopath/archive/2005/06/17/430347.aspx&gt;http://blogs.msdn.com/infopath/archive/2005/06/17/430347.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;InfoPath Dev Texas&lt;br /&gt;</description></item><item><title>Re: Call code from a rule...?</title><link>https://www.infopathdev.com:443/forums/thread/8989.aspx</link><pubDate>Tue, 07 Feb 2006 19:15:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:8989</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/8989.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=8989</wfw:commentRss><description>Yes, you can do this.  Attach the following code to the OnAfterChange event of the drop-down list:&lt;br /&gt;&lt;br /&gt;XDocument.View.SwitchView( e.Site.text );&lt;br /&gt;&lt;br /&gt;To generate the event function, find the node that the drop-down list is bound to in the Data Source task pane, Double-click it, choose Data Validation and Event Handlers, select OnAfterChange, and then click Edit.  &lt;br /&gt;&lt;br /&gt;Depending on how you have your form set up, the Microsoft Script Editor or Visual Studio should open with a freshly generated function that will be executed whenever the value of your drop-down list changes.&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;InfoPath Dev Texas&lt;br /&gt;</description></item><item><title>Re: Call code from a rule...?</title><link>https://www.infopathdev.com:443/forums/thread/8988.aspx</link><pubDate>Tue, 07 Feb 2006 18:28:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:8988</guid><dc:creator>Karsten Brocksieper</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/8988.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=8988</wfw:commentRss><description>Hello,&lt;br /&gt;&lt;br /&gt;... in my special case I want to switch between different views after selected these views in a drop-down list. I wonder that I have the opportunity to call a rule action type "switch view" if I use a command button but I don´t have the same rule action type by using a drop-down list. In my opinion this is a little bit curious... ;-)&lt;br /&gt;Furthermore I can´t see that I can attach any code to the events (Are there any?) of a drop-down list.&lt;br /&gt;&lt;br /&gt;What I would like to do at least is to switch between different views immediately after the selection of them in a drop-down list without additionally press a command button.&lt;br /&gt;&lt;br /&gt;Thanks for all your help.&lt;br /&gt;&lt;br /&gt;Karsten</description></item><item><title>Re: Call code from a rule...?</title><link>https://www.infopathdev.com:443/forums/thread/8987.aspx</link><pubDate>Tue, 07 Feb 2006 17:48:11 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:8987</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/8987.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=8987</wfw:commentRss><description>Hi Karsten and welcome to our forum!&lt;br /&gt;&lt;br /&gt;What is your rule attached to? If it is a button, then you can just attached the code to the button and it will be executed when the button is clicked.  Otherwise, you might want to look at the OnBeforeChange() and OnAfterChange() events - maybe you can attach your code to one of these events of the control that you are running rules on.&lt;br /&gt;&lt;br /&gt;Could you provide a little more information please? Like what is the rule doing? What is the code doing? Why can't you combine the two?&lt;br /&gt;&lt;br /&gt;I hope this helps!&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;InfoPath Dev Texas&lt;br /&gt;</description></item><item><title>Re: Call code from a rule...?</title><link>https://www.infopathdev.com:443/forums/thread/8986.aspx</link><pubDate>Tue, 07 Feb 2006 17:46:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:8986</guid><dc:creator>vt_asparagus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/8986.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=8986</wfw:commentRss><description>I have tried in the past I was not able to, but someone please correct me if I am wrong because I would love to be able to do that too.  &lt;br /&gt;&lt;br /&gt;I was able to call code to do conditional formatting (search on xdExtension for more information).</description></item><item><title>Call code from a rule...?</title><link>https://www.infopathdev.com:443/forums/thread/5330.aspx</link><pubDate>Tue, 07 Feb 2006 13:46:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:5330</guid><dc:creator>Karsten Brocksieper</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/5330.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=5330</wfw:commentRss><description>Hello,&lt;br /&gt;&lt;br /&gt;I´m new to infopath and actually I´m developing my first dynamic form in infopath.&lt;br /&gt;Now I want to call a function (Jscript) from a rule but I haven´t found a rules action type "Call code" or something similar.&lt;br /&gt;&lt;br /&gt;Isn´t it possible to call code/script from a rule?&lt;br /&gt;&lt;br /&gt;I appreciate any help.&lt;br /&gt;&lt;br /&gt;Karsten</description></item></channel></rss>