<?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: Clear all values from fields</title><link>https://www.infopathdev.com:443/forums/thread/47135.aspx</link><pubDate>Fri, 18 Sep 2009 14:58:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47135</guid><dc:creator>xfields</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47135.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=47135</wfw:commentRss><description>&lt;p&gt;Dont realy understand the trick with the main datadource &lt;/p&gt;
&lt;p&gt;But....for me works the following code:&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&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;public&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; clearForm_OnClick(&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;DocActionEvent&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; e)&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;{&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;IXMLDOMNodeList&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; nodes = thisXDocument.DOM.selectNodes(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;//*&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;);&lt;/p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;IXMLDOMNode&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; node = nodes.nextNode();&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;while&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (node != &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (node.selectNodes(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;child::*&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;).length == 0)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;try&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;{&lt;/p&gt;node.text = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;catch&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;Exception&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; nodeNoTextEx)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{ }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;try&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;node = nodes.nextNode();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;catch&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;Exception&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; nodeNotExsistEx)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;node = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;This get all the nodes out of the dom and set the text-attribute to &amp;quot;&amp;quot; as long as there is a node.&lt;/p&gt;
&lt;p&gt;If u use for example the hungry notation for the naming or just use the default u can easyly select some sub volume/area like only groups or fields or or or&lt;/p&gt;</description></item><item><title>Re: Clear all values from fields</title><link>https://www.infopathdev.com:443/forums/thread/27372.aspx</link><pubDate>Fri, 21 Mar 2008 16:23:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27372</guid><dc:creator>Clay Fox</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27372.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=27372</wfw:commentRss><description>&lt;p&gt;No that is not normal with a database type form, where the DFS datafields are present.&lt;/p&gt;
&lt;p&gt;Depending on code, field&amp;nbsp;validation,&amp;nbsp;or possibly other corruption could maybe cause this.&lt;/p&gt;
&lt;p&gt;When you open a new form, they should be blank and allow input. Is this the case?&lt;/p&gt;
&lt;p&gt;You can always create a test form, with the query and data fields exposed and test the query with a blank results with that.&lt;/p&gt;</description></item><item><title>Re: Clear all values from fields</title><link>https://www.infopathdev.com:443/forums/thread/27371.aspx</link><pubDate>Fri, 21 Mar 2008 15:59:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27371</guid><dc:creator>AlphaCity7</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27371.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=27371</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I seem to have reached a point in my form that whenever I query a result that is not present, it disables the controls of all the dataFields in that connection. Is this normal?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;As a result, the removeAll() method and the query method (eg. ID = 99999) lead to the same situation, the fields become blocked and I am unable to enter back any information.&lt;/p&gt;</description></item><item><title>Re: Clear all values from fields</title><link>https://www.infopathdev.com:443/forums/thread/27327.aspx</link><pubDate>Wed, 19 Mar 2008 17:51:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27327</guid><dc:creator>Clay Fox</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27327.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=27327</wfw:commentRss><description>&lt;p&gt;The easy trick for this is to requery your main data source with a value that is not present(does not return any results).&amp;nbsp; Then it will return blank values in your data fields, except for any defaults.&lt;/p&gt;
&lt;p&gt;So query where ID = 99999 or whatever and that effectively resets all the fields and new data can be added just like a new record.&lt;/p&gt;</description></item><item><title>Clear all values from fields</title><link>https://www.infopathdev.com:443/forums/thread/27324.aspx</link><pubDate>Wed, 19 Mar 2008 16:58:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27324</guid><dc:creator>AlphaCity7</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27324.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=27324</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi all,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I have an issue I need fixing. I wanted to clear all values in fields when the user clicks a button so I altered code (jscript)&amp;nbsp;from this forum (&lt;a href="http://www.infopathdev.com/forums/p/5914/22037.aspx#22037" target="_blank"&gt;http://www.infopathdev.com/forums/p/5914/22037.aspx#22037&lt;/a&gt;) to help me out as follows:&lt;/p&gt;
&lt;p&gt;var objSource = XDocument.DOM.selectNodes(&amp;quot;/dfs:myFields/dfs:dataFields/d:Training_Tool&amp;quot;); &lt;br /&gt;objSource.removeAll();&lt;/p&gt;
&lt;p&gt;The problem is everytime this operation occurs it disables all my controls. This person had a similar problem (&lt;a href="http://www.infopathdev.com/forums/p/6005/22452.aspx#22452"&gt;http://www.infopathdev.com/forums/p/6005/22452.aspx#22452&lt;/a&gt;). I tried altering my code accordingly however no luck. They are using &amp;#39;IXMLDOMS&amp;#39; and, while&amp;nbsp;not being a good programmer, I don&amp;#39;t quite know how to implement that or if it even applies to my situation.&lt;/p&gt;
&lt;p&gt;I have too many nodes to manually set each to blank (i.e. XDocument.DOM.selectSingleNode(&amp;quot;dfs:myFields/dfs:dataFields/d:Training_Tool/@OverallStatus&amp;quot;).text = &amp;quot;&amp;quot;;).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Any ideas?&lt;/p&gt;</description></item></channel></rss>