<?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: Reset form on submit using Visual Basic coding</title><link>https://www.infopathdev.com:443/forums/thread/58895.aspx</link><pubDate>Mon, 13 Sep 2010 02:59:19 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:58895</guid><dc:creator>ZhenYuan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/58895.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=58895</wfw:commentRss><description>&lt;p&gt;Thanks again! It worked! But I put the catch line just before the delete line, I suppose the catch line was set to &amp;quot;start up&amp;quot; the data source so that it won&amp;#39;t be null?&lt;/p&gt;
&lt;p&gt;Regarding the re-query, I used by original buttons. Just that the rules went: 1) Query Data connection 2) Insert search query 3) Query Data connection. Previously, I only had 2) and 3) but now I&amp;#39;ve added 1) to re-initialize the data connection. An extra rule but a required one if I deleted the data connection on reset.&lt;/p&gt;</description></item><item><title>Re: Reset form on submit using Visual Basic coding</title><link>https://www.infopathdev.com:443/forums/thread/58882.aspx</link><pubDate>Sun, 12 Sep 2010 12:53:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:58882</guid><dc:creator>Potemkine</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/58882.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=58882</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi, you can place your try catch just on the line to delete your secondary data connection, you can also make an if statemment like &lt;/p&gt;&lt;p&gt;if (test.innerxml !=&amp;quot;&amp;quot;)&lt;/p&gt;&lt;p&gt;.&lt;/p&gt;&lt;p&gt;.&lt;/p&gt;&lt;p&gt;.For your other issue, you have to Re query your dataconnection because you just delete it.You can set a rules or codes (the one on my last post)if you have an issue with that when you try it, please use a separate button with just a rule that query your dataconnection.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Reset form on submit using Visual Basic coding</title><link>https://www.infopathdev.com:443/forums/thread/58881.aspx</link><pubDate>Sun, 12 Sep 2010 07:13:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:58881</guid><dc:creator>ZhenYuan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/58881.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=58881</wfw:commentRss><description>&lt;p&gt;Hi Potemkine,&lt;/p&gt;
&lt;p&gt;You mean place the try catch code in the reset button code or in the Query button code (the query button which did not work after the reset). &lt;/p&gt;
&lt;p&gt;My form has a rest button as well as several Query buttons in the form where users can click to query our database based on certain inputs in the form. My aim is to have a form where users can reset the form after a wrong filling and the data sources are cleared for reuse.&lt;/p&gt;
&lt;p&gt;Right now, if I click the reset button twice, a null error occurs. The separate issue is that after using the code to clear data source, my query button fails as well. It fails to perform its original task of connecting to the data source for data.&lt;/p&gt;</description></item><item><title>Re: Reset form on submit using Visual Basic coding</title><link>https://www.infopathdev.com:443/forums/thread/58876.aspx</link><pubDate>Sat, 11 Sep 2010 18:15:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:58876</guid><dc:creator>Potemkine</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/58876.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=58876</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi, you have to query your data connection with rules or code to make them re-usable. You can make a try catch for your null exection&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Me.DataSources[&amp;quot;DATACONNECTION&amp;quot;].QueryConnection.Execute(); &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Reset form on submit using Visual Basic coding</title><link>https://www.infopathdev.com:443/forums/thread/58874.aspx</link><pubDate>Sat, 11 Sep 2010 10:38:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:58874</guid><dc:creator>ZhenYuan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/58874.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=58874</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This worked fine for the first time only. After which, if I try to reset again, I get a System.NullReferenceException error. I tried doing checks for nulls using:&lt;/p&gt;
&lt;p&gt;XPathNavigator test = Me.DataSources[&amp;quot;DATACONNECTION&amp;quot;].CreateNavigator();&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;If&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; test.SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;dfs:myFields&amp;quot;&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;Me&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.NamespaceManager).Value &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Is&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; DBNull.Value &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Then&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;else&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font size="2"&gt;
&lt;p&gt;test.SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;dfs:myFields&amp;quot;&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;Me&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.NamespaceManager).DeleteSelf()&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;End&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;If&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;
&lt;p&gt;In any case, after the first deleteself, the data connection is unusable from then on! When I try to perform my query using the data connection, an error pops out:&lt;/p&gt;
&lt;p&gt;Some rules were not applied. The parameter is incorrect.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Any clues to help? Thanks!&lt;/p&gt;&lt;font size="1"&gt;&lt;/font&gt;&lt;font size="1"&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Reset form on submit using Visual Basic coding</title><link>https://www.infopathdev.com:443/forums/thread/58860.aspx</link><pubDate>Fri, 10 Sep 2010 15:50:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:58860</guid><dc:creator>Potemkine</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/58860.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=58860</wfw:commentRss><description>&lt;p&gt;Hi ZhenYuan,&lt;/p&gt;
&lt;p&gt;try this:&lt;/p&gt;
&lt;p&gt;XPathNavigator test = Me.DataSources[&amp;quot;DATACONNECTION&amp;quot;].CreateNavigator();&lt;br /&gt;test.SelectSingleNode(&amp;quot;dfs:myFields&amp;quot;,Me.NamespaceManager).DeleteSelf();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Reset form on submit using Visual Basic coding</title><link>https://www.infopathdev.com:443/forums/thread/58830.aspx</link><pubDate>Thu, 09 Sep 2010 15:59:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:58830</guid><dc:creator>ZhenYuan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/58830.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=58830</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Hi Potemkine, Now I need to go one better. Remember previously I wanted to reset all field values from my form via a button? That was settled. Now I want to reset even the secondary data connections. Can I use some code (Visual Basic) to clear my specific data connections?&lt;/p&gt;
&lt;p&gt;My form has some search function whicn populates a listbox with its results. I noticed that resetting the form clears all the form fields but not the listbox because it is tied to a data connection that is holding data from the previous search.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Hope you have a solution?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;</description></item><item><title>Re: Reset form on submit using Visual Basic coding</title><link>https://www.infopathdev.com:443/forums/thread/58046.aspx</link><pubDate>Mon, 16 Aug 2010 15:43:23 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:58046</guid><dc:creator>Potemkine</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/58046.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=58046</wfw:commentRss><description>&lt;p&gt;Hi Zhen Yuan, if you&amp;nbsp;use data validation instead of mandatory field you get an red mark on your textbox, the user can know&amp;nbsp; exactly where the error is. You configure it on the text box not on the field, that why you won&amp;#39;t have an issue on the submit for your reference field.&lt;/p&gt;
&lt;p&gt;But If you prefer to replace your 12 fields it works too.&lt;/p&gt;</description></item><item><title>Re: Reset form on submit using Visual Basic coding</title><link>https://www.infopathdev.com:443/forums/thread/58016.aspx</link><pubDate>Mon, 16 Aug 2010 07:31:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:58016</guid><dc:creator>ZhenYuan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/58016.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=58016</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Your first suggestion won&amp;#39;t be good for my users. They would want to know exactly where the error is, ie, which field they keyed incorrectly. lf I were to put the error on submit, they would have to scroll and find the field. I&amp;#39;ll get stick for this :(&lt;/p&gt;
&lt;p&gt;For your second suggestion, how do you remove a reference? Are you suggesting: create 2 clones of form_container, one as the default form while the other has dummy data in the mandatory fields. On Reset, the default form clone refreshes the form while the dummy clone clones the default form clone (so that now there are no empty mandatory fields in the default form clone)? &lt;/p&gt;
&lt;p&gt;Anyway, I used your replace field code to replace the refreshed form and it works fine. I have like 12 such lines of replacements but it suits my purpose just fine. Especially when this allows me to continuously reset the form. &lt;/p&gt;
&lt;p&gt;Now for emailing the form as a template... my buttons went missing! Shall look for a related thread or post a new one soon!&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;</description></item><item><title>Re: Reset form on submit using Visual Basic coding</title><link>https://www.infopathdev.com:443/forums/thread/57982.aspx</link><pubDate>Fri, 13 Aug 2010 16:04:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:57982</guid><dc:creator>Potemkine</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/57982.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=57982</wfw:commentRss><description>&lt;p&gt;Hi Zhen Yuan, if you have 10 mandatory fields it could be easier if you replace your mandatory field by data validation you just have your error message on the submit&amp;nbsp;for your form_container node.&lt;/p&gt;
&lt;p&gt;If you can&amp;#39;t do that, you can create manually an xml node like your&amp;nbsp; form_container and use&amp;nbsp;it like your clone&amp;nbsp;and remove the reference.&lt;/p&gt;</description></item><item><title>Re: Reset form on submit using Visual Basic coding</title><link>https://www.infopathdev.com:443/forums/thread/57950.aspx</link><pubDate>Fri, 13 Aug 2010 01:19:06 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:57950</guid><dc:creator>ZhenYuan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/57950.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=57950</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I suppose your &amp;quot;my:Field1&amp;quot; refers to all my individual mandatory fields? Meaning if I have 10 such fields, I must individually setvalue to &amp;quot;&amp;quot; right? I tried for one field and it works. Just wondering if I am doing it right or doing it the long way.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thanks again for your greatly appreciated help!&lt;/p&gt;</description></item><item><title>Re: Reset form on submit using Visual Basic coding</title><link>https://www.infopathdev.com:443/forums/thread/57917.aspx</link><pubDate>Thu, 12 Aug 2010 12:05:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:57917</guid><dc:creator>Potemkine</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/57917.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=57917</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi, an easy way is to put some default value on your reference mandatory field. And modify your reset bouton to empty it when it clicked: add this code at the end of your function:&lt;/p&gt;&lt;p&gt;Me.CreateNavigator().SelectSingleNode(&amp;quot;/my:myFields/my:Form_Container/my:Field1&amp;quot;, Me.NamespaceManager).SetValue(&amp;quot;&amp;quot;) &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Reset form on submit using Visual Basic coding</title><link>https://www.infopathdev.com:443/forums/thread/57915.aspx</link><pubDate>Thu, 12 Aug 2010 10:30:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:57915</guid><dc:creator>ZhenYuan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/57915.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=57915</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I&amp;#39;m stuck again :( &lt;/p&gt;
&lt;p&gt;My form has mandatory fields and since I cloned the container at the beginning, the clone has the empty mandatory fields! And of course, the form now fails to get submitted as the required fields are empty...&lt;/p&gt;
&lt;p&gt;Is there a way to remove the clone using my submit button? I&amp;#39;m using DBXL&amp;#39;s web service submit and thus my submit button has no code to alter. If I choose to alter the submit code, they give me a clean slate to code my submit and I have no idea how to code all those web service data connections, etc... &lt;/p&gt;
&lt;p&gt;Attached is my sample form again with a mandatory field. Preview it, fill up the mandatory field and try to submit. You will see what I mean...&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;</description></item><item><title>Re: Reset form on submit using jscript?</title><link>https://www.infopathdev.com:443/forums/thread/57907.aspx</link><pubDate>Thu, 12 Aug 2010 03:08:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:57907</guid><dc:creator>Potemkine</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/57907.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=57907</wfw:commentRss><description>You&amp;#39;re welcome !&lt;br /&gt;</description></item><item><title>Re: Reset form on submit using jscript?</title><link>https://www.infopathdev.com:443/forums/thread/57906.aspx</link><pubDate>Thu, 12 Aug 2010 02:13:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:57906</guid><dc:creator>ZhenYuan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/57906.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=57906</wfw:commentRss><description>&lt;p&gt;Thank you so much! It works now!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thanks again!&lt;/p&gt;</description></item></channel></rss>