<?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>Browser Forms</title><link>https://www.infopathdev.com:443/forums/40.aspx</link><description>For browser form specific questions</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Clearing an attachment from an InfoPath form</title><link>https://www.infopathdev.com:443/forums/thread/85235.aspx</link><pubDate>Tue, 11 Dec 2012 18:43:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:85235</guid><dc:creator>Plee_agi</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/85235.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=85235</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;I tired your second code (which has the CreateAttribute line).&amp;nbsp; This successfully cleared the attachment control -- and it does not leave me with a validation error.&lt;/p&gt;&lt;p&gt;Thanks for your help! &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Clearing an attachment from an InfoPath form</title><link>https://www.infopathdev.com:443/forums/thread/85234.aspx</link><pubDate>Tue, 11 Dec 2012 18:30:47 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:85234</guid><dc:creator>Plee_agi</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/85234.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=85234</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;No. The script that I posted does not cause validation error.&lt;/p&gt;&lt;p&gt;The error occurred when I copied the script from the 2nd link, which dateTime object as a parameter to SetValue.&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Do I really need to CreateAttribute after DeleteSelf? &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Clearing an attachment from an InfoPath form</title><link>https://www.infopathdev.com:443/forums/thread/85233.aspx</link><pubDate>Tue, 11 Dec 2012 17:14:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:85233</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/85233.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=85233</wfw:commentRss><description>&lt;p&gt;Well, that&amp;#39;s still not really how it should be.&amp;nbsp; Are you saying that this causes a validation error?&lt;/p&gt;&lt;p&gt;public void FormEvents_ViewSwitched(object sender, ViewSwitchedEventArgs e)&lt;br /&gt;&amp;nbsp;{&lt;/p&gt;&lt;p&gt;&amp;nbsp;XPathNavigator root = MainDataSource.CreateNavigator();&lt;br /&gt;&amp;nbsp;XPathNavigator attachment = root.SelectSingleNode(&amp;quot;//my:myFields/my:Attachment&amp;quot;, NamespaceManager);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp; if (!attachment.MoveToAttribute(&amp;quot;nil&amp;quot;, attachment.LookupNamespace(&amp;quot;xsi&amp;quot;)))&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;if (attachment.MoveToFirstChild())&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; attachment.DeleteSelf();&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;attachment.CreateAttribute(&amp;quot;xsi&amp;quot;, &amp;quot;nil&amp;quot;,attachment.LookupNamespace(&amp;quot;xsi&amp;quot;), &amp;quot;true&amp;quot;);&lt;br /&gt;&amp;nbsp;}&lt;/p&gt;&lt;p&gt;}&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Clearing an attachment from an InfoPath form</title><link>https://www.infopathdev.com:443/forums/thread/85232.aspx</link><pubDate>Tue, 11 Dec 2012 16:54:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:85232</guid><dc:creator>Plee_agi</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/85232.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=85232</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Yes I did try it -- copied the exact script which resulted in the validation error.&lt;/p&gt;&lt;p&gt;After further experimenting, this solution finally did the trick:&lt;/p&gt;&lt;p&gt;&amp;nbsp;public void FormEvents_ViewSwitched(object sender, ViewSwitchedEventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator root = MainDataSource.CreateNavigator();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator attachment = root.SelectSingleNode(&amp;quot;//my:myFields/my:Attachment&amp;quot;, NamespaceManager);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (attachment.MoveToAttribute(&amp;quot;nil&amp;quot;, attachment.LookupNamespace(&amp;quot;xsi&amp;quot;)))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attachment.DeleteSelf();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attachment.SetValue(&amp;quot;&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;Thanks for your insight!&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Clearing an attachment from an InfoPath form</title><link>https://www.infopathdev.com:443/forums/thread/85231.aspx</link><pubDate>Tue, 11 Dec 2012 16:15:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:85231</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/85231.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=85231</wfw:commentRss><description>&lt;p&gt;I see.&amp;nbsp; The instructions in that new link you&amp;#39;ve posted are for the opposite of what you&amp;#39;re trying to do.&amp;nbsp;&amp;nbsp;Those instructions show how to remove a nil attribute and then set a field&amp;#39;s value, but what you need to do is clear the field&amp;#39;s value and add a nil attribute.&lt;/p&gt;&lt;p&gt;I believe that if you use the code modification I indicated in my last post, you should be all set.&amp;nbsp; Did you try that?&lt;/p&gt;</description></item><item><title>Re: Clearing an attachment from an InfoPath form</title><link>https://www.infopathdev.com:443/forums/thread/85230.aspx</link><pubDate>Tue, 11 Dec 2012 15:46:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:85230</guid><dc:creator>Plee_agi</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/85230.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=85230</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Thanks for your reply.&amp;nbsp;&lt;/p&gt;&lt;p&gt;The reason that I am not using rules:&amp;nbsp; the original posting did not offer such a solution.&amp;nbsp; You either did it manually or use his script. &lt;/p&gt;&lt;p&gt;My project requirements are:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Create a form solution published to SharePoint.&lt;/li&gt;&lt;li&gt;Add a feature that allow users to upload documents to a document library on the same form.&amp;nbsp; No switching pages for end users -- it should be seamless.&lt;/li&gt;&lt;li&gt;Clear the attachment to upload another next document.&amp;nbsp; Having users to manual remove the exiting content is not acceptable.&amp;nbsp; (YUP, I am programming something that SharePoint already does well, but in InfoPath)&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;I found this solution &amp;gt;&amp;gt; http://blogs.msdn.com/b/infopath/archive/2006/11/28/the-xsi-nil-attribute.aspx&amp;nbsp; and tested the script.&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;This solution includes &amp;quot;node.DeleteSelf()&amp;quot; but require that I set a value to the node.&lt;/li&gt;&lt;li&gt;In the example it set a date value to the node.&amp;nbsp; I guess he was trying to clear a date field. I do not know how to set a value to an attachment; nor understand why I should do so.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;When I implemented the code, it **almost** works.&amp;nbsp; After running the code, I get a validation error (red asterisk) on the attachment.&amp;nbsp; This would not go away until I attach a new document.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;</description></item><item><title>Re: Clearing an attachment from an InfoPath form</title><link>https://www.infopathdev.com:443/forums/thread/85218.aspx</link><pubDate>Tue, 11 Dec 2012 08:54:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:85218</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/85218.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=85218</wfw:commentRss><description>&lt;p&gt;In browser forms, even if you use&amp;nbsp;&lt;span class="tab"&gt;&lt;font face="Courier New"&gt;attachment.SetValue(&amp;quot;&amp;quot;); to clear a field, it will be treated as non-empty when you try to add the nil attribute.&amp;nbsp; Instead of that line, you can use this, which will work in both the filler and the browser:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="tab"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (attachment.MoveToFirstChild())&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attachment.DeleteSelf();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="tab"&gt;But is there a reason you&amp;#39;re using code to clear out attachments?&amp;nbsp; This can be done with rules just fine.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Clearing an attachment from an InfoPath form</title><link>https://www.infopathdev.com:443/forums/thread/85096.aspx</link><pubDate>Wed, 05 Dec 2012 22:58:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:85096</guid><dc:creator>Plee_agi</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/85096.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=85096</wfw:commentRss><description>&lt;p&gt;I&amp;nbsp;am writing a code that would&amp;nbsp;programatically remove&amp;nbsp;any content from&amp;nbsp;an Attachment control.&amp;nbsp; There is a nice article about this from bizsupportonline &amp;gt;&amp;gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.bizsupportonline.net/blog/2009/10/delete-remove-clear-attachment-infopath-form/"&gt;http://www.bizsupportonline.net/blog/2009/10/delete-remove-clear-attachment-infopath-form/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;a. I&amp;nbsp;created an&amp;nbsp;InfoPath 2010 form, with an Attachment control.&amp;nbsp;I applied this code to&amp;nbsp;the form&amp;#39;s Loading Event.&amp;nbsp;&amp;nbsp;I published&amp;nbsp;to SharePoint 2010; and set the form library to &amp;#39;Open in Browser&amp;#39;&lt;/p&gt;
&lt;p&gt;b. I then added a document and attached a file to the document.&lt;/p&gt;
&lt;p&gt;This solution works, but only when I reopen using &amp;quot;Edit Microsoft&amp;nbsp;InfoPath&amp;quot;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;When open the form using a browser (Windows 7 Enterprise SP1), I would get a warning message with a correlation id.&amp;nbsp; The trace log gave me this message:&lt;/p&gt;
&lt;p&gt;&amp;quot;Business logic failed due to an exception. (User: , Form Name: AttachmentDemo, IP: , Request: , Form ID: urn:schemas-microsoft-com:office:infopath:AttachmentDemo:-myXSD-2012-12-05T20-59-41, Type: SchemaValidationException, Exception Message: Schema validation found non-datatype errors.)&amp;quot;&lt;/p&gt;
&lt;p&gt;Is ther something that I should do differently to clear an attachment control in browser mode?&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></channel></rss>