<?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: buttons rules and text boxes - NEED URGENT</title><link>https://www.infopathdev.com:443/forums/thread/13368.aspx</link><pubDate>Mon, 18 Jul 2005 18:21:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13368</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13368.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13368</wfw:commentRss><description>The first approach is invalid code. The second approach is the correct one:&lt;br /&gt;&lt;br /&gt;    XDocument.DOM.selectSingleNode("/my:myFields/my:flag").Text = "1";&lt;br /&gt;&lt;br /&gt;What is the error you are getting?&lt;br /&gt;&lt;br /&gt;Are you attempting to do this in an OnBeforeChange or OnValidate event handler? The DOM is readonly during those events and you will not be able to update values.&lt;br /&gt;&lt;br /&gt;You cannot run rules from code. This is not supported. However, you can call into code from the rule condition and have your code return true or false to decide whether to run the rule. To do this, see my article "Use Code to Determine a Rule Condition":&lt;a target="_blank" href=http://www.infopathdev.com/howto/tutorials/default.aspx?i=88f921f13dec4e7cae61191bac084fff&gt;http://www.infopathdev.com/howto/tutorials/default.aspx?i=88f921f13dec4e7cae61191bac084fff&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Greg Collins [InfoPath MVP]&lt;br /&gt;InfoPath Dev</description></item><item><title>buttons rules and text boxes - NEED URGENT</title><link>https://www.infopathdev.com:443/forums/thread/12499.aspx</link><pubDate>Mon, 18 Jul 2005 14:40:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12499</guid><dc:creator>buzzby</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12499.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12499</wfw:commentRss><description>hi&lt;br /&gt;&lt;br /&gt;First of all how can i set the value of a textbox that is formatted as a number field as i cannot get it to work.&lt;br /&gt;&lt;br /&gt;XDocument.DOM.selectSingleNode("/my:myFields/my:flag") = 1;&lt;br /&gt;and&lt;br /&gt;XDocument.DOM.selectSingleNode("/my:myFields/my:flag").Text = "1";&lt;br /&gt;&lt;br /&gt;do not work.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Also i have some rules setup on some buttons but i only want those rules to run if an IF statment with the code of the button is true.&lt;br /&gt;&lt;br /&gt;How can i run rules through JScript.&lt;br /&gt;&lt;br /&gt;Thanks</description></item></channel></rss>