<?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: Disable textbox from code</title><link>https://www.infopathdev.com:443/forums/thread/21171.aspx</link><pubDate>Sat, 23 Jun 2007 11:15:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21171</guid><dc:creator>saudak</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21171.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=21171</wfw:commentRss><description>&lt;p&gt;Thanx Dave !&lt;/p&gt;&lt;p&gt;Im a web programmer, I always think the &amp;#39;code&amp;#39; way, &lt;/p&gt;&lt;p&gt;thanx again&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Disable textbox from code</title><link>https://www.infopathdev.com:443/forums/thread/20948.aspx</link><pubDate>Tue, 19 Jun 2007 15:50:54 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20948</guid><dc:creator>davidair</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20948.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20948</wfw:commentRss><description>&lt;p&gt;Hey saudak,&lt;/p&gt;&lt;p&gt;to make a textbox read-only, double-click on it, select Display then Conditional Formatting.&lt;/p&gt;&lt;p&gt;Add your condition, then check the read-only box.&lt;/p&gt;&lt;p&gt;Your condition may depend on another field. Now you can set this field either via rules, calculation or code, it&amp;#39;s up to you!&lt;/p&gt;&lt;p&gt;This is the only way of dynamically changing the read-only property, via the conditional formatting mechanism. You cannot change control properties via code because controls are not exposed to code, only data is.&lt;/p&gt;</description></item><item><title>Re: Disable textbox from code</title><link>https://www.infopathdev.com:443/forums/thread/20909.aspx</link><pubDate>Tue, 19 Jun 2007 06:53:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20909</guid><dc:creator>saudak</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20909.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20909</wfw:commentRss><description>&lt;p&gt;Hi dave,&lt;/p&gt;&lt;p&gt;Thanx for the reply and the Idea,&lt;/p&gt;&lt;p&gt;I will try it ASAP, But how do you make a textbox readonly, can I do it from InfoPath or should I write code?&lt;/p&gt;</description></item><item><title>Re: Disable textbox from code</title><link>https://www.infopathdev.com:443/forums/thread/20890.aspx</link><pubDate>Mon, 18 Jun 2007 16:37:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20890</guid><dc:creator>davidair</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20890.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20890</wfw:commentRss><description>&lt;p&gt;Hello saudak,&lt;/p&gt;&lt;p&gt;You cannot manipulate the form controls in the code - the only thing you can access is the XML data. As such , selectSingleNode returns you an XML node, you can only change its value and you can never communicate directly with the control that displays that value. Because of this, there is simply no Enabled property available on the XML DOM node.&lt;/p&gt;&lt;p&gt;The correct way to achieve the functionality you require is to use conditional formatting in the view and then use code to change the condition that affects the formatting:&lt;/p&gt;&lt;p&gt;1. Add an extra&amp;nbsp;node (say field1) to the data source that determines whether or not your target control is enabled or disabled (this node will only exist in the data source... if you want to keep it clean it&amp;#39;s better to put in into an aux-dom but this is more advanced)&lt;/p&gt;&lt;p&gt;2. Add conditional formatting to your textbox saying that whenever field1 is, for example, 1 then your textbox is set to read-only (note that you cannot disable a textbox, you can only set it to read-only or hidden).&lt;/p&gt;&lt;p&gt;3. In your code, set the value of field1 to 1 or 0 depending on what you need&lt;/p&gt;&lt;p&gt;Good luck with this!&lt;/p&gt;&lt;p&gt;Dave.&lt;/p&gt;</description></item><item><title>Disable textbox from code</title><link>https://www.infopathdev.com:443/forums/thread/20866.aspx</link><pubDate>Sat, 16 Jun 2007 07:18:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20866</guid><dc:creator>saudak</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20866.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20866</wfw:commentRss><description>&lt;p&gt;I have 2 radio buttons, on the selection of either, I need to enable or disable textboxes from script (I use VBscript)&lt;/p&gt;&lt;p&gt;&amp;nbsp;Below, Select is a optionbutton with text valoes of &amp;#39;Old&amp;#39; and &amp;#39;New&amp;#39;&lt;/p&gt;&lt;p&gt;Old and New Are 2 textboxes&lt;/p&gt;&lt;p&gt;But this code is &lt;strong&gt;NOT WORKING&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Sub msoxd_my_Select_OnAfterChange(eventObj)&lt;/p&gt;&lt;p&gt;if XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:Select&amp;quot;).text = &amp;quot;Old&amp;quot; then&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:Old&amp;quot;).Enabled = True&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:New&amp;quot;).Enabled = False&lt;/p&gt;&lt;p&gt;End if&lt;/p&gt;&lt;p&gt;if XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:Select&amp;quot;).text = &amp;quot;New&amp;quot; then&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:New&amp;quot;).Enabled = True&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:Old&amp;quot;).Enabled = False&lt;/p&gt;&lt;p&gt;End if&lt;/p&gt;&lt;p&gt;end sub&amp;nbsp;&lt;/p&gt;&lt;p&gt;Please tell me how do I do this :- &lt;em&gt;XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:New&amp;quot;).Enabled = True&lt;/em&gt;&lt;/p&gt;</description></item></channel></rss>