<?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: FormError properties fails in a browser-enabled form</title><link>https://www.infopathdev.com:443/forums/thread/61034.aspx</link><pubDate>Wed, 03 Nov 2010 00:28:47 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:61034</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/61034.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=61034</wfw:commentRss><description>&lt;p&gt;I just tried this with a sample form. Very simple form, with code that returns the error message to a field in the form. My form ran without issue -- no trouble with the code. I&amp;#39;m attaching it code and all in a zip to this post.&lt;/p&gt;&lt;p&gt;The form was created in IP 2010, set to IP 2007 compatibility and admin deployed as a content type so it could be opened in the browser....&lt;/p&gt;</description></item><item><title>Re: FormError properties fails in a browser-enabled form</title><link>https://www.infopathdev.com:443/forums/thread/60944.aspx</link><pubDate>Mon, 01 Nov 2010 11:17:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:60944</guid><dc:creator>Alf Kiil</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/60944.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=60944</wfw:commentRss><description>&lt;p&gt;Hi Hilary,&lt;/p&gt;
&lt;p&gt;Still throws the same error for Site property, e.g. Site.Localname.ToString(). (Here I believe ToString() is required. I&amp;#39;ve excluded other properties while testing). &lt;/p&gt;
&lt;p&gt;And yes, the extra &lt;span&gt;parenthesis was a typo. I&amp;#39;ve also removed the superfluous ToString(), which didn&amp;#39;t seem to influence the outcome anyway.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Without luck, I&amp;#39;ve already investigated the condition on MSDN that &amp;quot;This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.&amp;quot; &lt;/span&gt;&lt;span&gt;Could my problem still have to do with that?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Maybe I should also mention that I&amp;#39;m developing InfoPath 2007 browser-enabled forms using InfoPath Designer 2010 (with the compatibility mode set to IP 2007 browserform), and the forms are published to a SharePoint 2007 server. Soon we&amp;#39;ll upgrade to SharePoint 2010, but I still have to survive with 2007 for some time.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Any more ideas?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Alf&lt;/p&gt;&lt;/span&gt;</description></item><item><title>Re: FormError properties fails in a browser-enabled form</title><link>https://www.infopathdev.com:443/forums/thread/60763.aspx</link><pubDate>Wed, 27 Oct 2010 23:45:20 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:60763</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/60763.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=60763</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.formerror.message.aspx"&gt;MSDN&lt;/a&gt; &lt;strong&gt;says&lt;/strong&gt; the Message property is availble for both client and browser.... So, I&amp;#39;d expect it to &lt;strong&gt;HAVE&lt;/strong&gt;&amp;nbsp;a Message property. What about the Site property? Does it also return null?&lt;/p&gt;&lt;p&gt;As a side note, there is an extra paren at the end of err.Message.ToString(), but I&amp;#39;m sure that&amp;#39;s just a typo, &amp;#39;cause you wouldn&amp;#39;t be able to compile like that.... and since Message is a string, I think ToString() is redundant here...&lt;/p&gt;</description></item><item><title>Re: FormError properties fails in a browser-enabled form</title><link>https://www.infopathdev.com:443/forums/thread/60730.aspx</link><pubDate>Wed, 27 Oct 2010 06:31:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:60730</guid><dc:creator>Alf Kiil</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/60730.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=60730</wfw:commentRss><description>&lt;p&gt;Hi Hilary,&lt;/p&gt;
&lt;p&gt;I already checked that NrErr works (and by the way, it&amp;#39;s just a counter value that is set for each new repeating group).&amp;nbsp;The error occurs&amp;nbsp;when I uncomment the first FormError property (Message). I&amp;#39;ve also tried without&amp;nbsp;writing error data to a new errornode (i.e. I&amp;#39;ve taken out NewGroup) and instead written an FormError property to a test variable:&lt;/p&gt;
&lt;p&gt;string TempVar = &amp;quot;&amp;quot;;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;foreach (FormError err in myErrors)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p&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; string TmpVar = err.Message.ToString());&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;And the code still throws the same error.&lt;/p&gt;
&lt;p&gt;Alf&lt;/p&gt;</description></item><item><title>Re: FormError properties fails in a browser-enabled form</title><link>https://www.infopathdev.com:443/forums/thread/60725.aspx</link><pubDate>Tue, 26 Oct 2010 19:32:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:60725</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/60725.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=60725</wfw:commentRss><description>&lt;p&gt;You need to find the line of code that is throwing the error -- not such an easy feat in a browser form. Theortically, you can use Visual Studio and attach to process for this -- in practice, I&amp;#39;ve never been successful with that approach.&lt;/p&gt;&lt;p&gt;So, I do one of two things:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Comment all the code out except the first line. Publish and open in the browser, click your button, make sure you don&amp;#39;t have an error. Uncomment the next line. Repeat until you know what line is throwing the error so you can start figuring out why.&lt;/li&gt;&lt;li&gt;Add a node for a message, and after each line, set the node&amp;#39;s value ot text with the line number. Publish, open the form, click the button (make sure you have the node on whatever view you&amp;#39;ll be seeing and the postback set on the control, and see what line you get to.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;You say you&amp;#39;ve narrowed the issue down to the Form Error properties -- Are you sure? Because your null reference exception could be occurring because the node you are trying to select from your NewGroup variable is null. You could split that out, check that the node (like NrErr) is not null prior to trying to set the value, just to be certain....&lt;/p&gt;</description></item><item><title>FormError properties fails in a browser-enabled form</title><link>https://www.infopathdev.com:443/forums/thread/60716.aspx</link><pubDate>Tue, 26 Oct 2010 16:31:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:60716</guid><dc:creator>Alf Kiil</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/60716.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=60716</wfw:commentRss><description>&lt;p&gt;Hi again.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve written code to populate a form errors list (to be displayed in an errors view when users trigger a button). It works great in client view, but fails in a browser-enabled form. After having spent a considerable time trying to solve this, I&amp;#39;ve concluded I&amp;#39;m in need of your considerable expertise.&lt;/p&gt;
&lt;p&gt;Tests indicate that the FormError properties (e.g. Message, Site.LocalName etc) are causing the problem.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here is the error message:&lt;/p&gt;
&lt;p&gt;Object reference not set to an instance of an object. &lt;/p&gt;
&lt;p&gt;System.NullReferenceException: Object reference not set to an instance of an object. &lt;/p&gt;
&lt;p&gt;at devIMDI_Soknad_P71Info2010.FormCode.ViewErrors_Clicked(Object sender, ClickedEventArgs e) &lt;/p&gt;
&lt;p&gt;at Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonEventHost.&amp;lt;&amp;gt;c__DisplayClass6.&amp;lt;&amp;gt;c__DisplayClassa.&amp;lt;add_Clicked&amp;gt;b__3() &lt;/p&gt;
&lt;p&gt;at Microsoft.Office.InfoPath.Server.Util.DocumentReliability.InvokeBusinessLogic(Thunk thunk) &lt;/p&gt;
&lt;p&gt;at Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonEventHost.&amp;lt;&amp;gt;c__DisplayClass6.&amp;lt;add_Clicked&amp;gt;b__2(Object sender, ClickedEventArgs e) &lt;/p&gt;
&lt;p&gt;at Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonEventHost.FireClickedEvent(Object sender, ClickedEventArgs args) &lt;/p&gt;
&lt;p&gt;at Microsoft.Office.InfoPath.Server.SolutionLifetime.ButtonFormCode.&amp;lt;&amp;gt;c__DisplayClass2.&amp;lt;&amp;gt;c__DisplayClass5.&amp;lt;Click&amp;gt;b__1() &lt;/p&gt;
&lt;p&gt;at Microsoft.Office.InfoPath.Server.DocumentLifetime.OMExceptionManager.CallFormCodeWithExceptionHandling(UserMessages userMessages, OMCall d)&lt;/p&gt;
&lt;p&gt;An entry has been added to the Windows event log of the server. &lt;/p&gt;
&lt;p&gt;Log ID:5337&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And here&amp;nbsp;are excerpts of the code that triggers the error:&lt;/p&gt;
&lt;p&gt;public void ViewErrors_Clicked(object sender, ClickedEventArgs e)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataSource ErrorsList = this.DataSources[&amp;quot;ErrorsList1&amp;quot;];&lt;/p&gt;
&lt;p&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 = ErrorsList.CreateNavigator();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; root.MoveToFirstChild();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NameTable nTbl = new NameTable();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XmlNamespaceManager nsMgrErrors = new XmlNamespaceManager(nTbl);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nsMgrErrors.AddNamespace(&amp;quot;nsErr&amp;quot;, root.NamespaceURI.ToString());&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string ErrorsGroup = &amp;quot;/nsErr:myFields/nsErr:ErrorsTable&amp;quot;;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int errCount = 0; //Setting counter to 0&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FormError[] myErrors;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myErrors = this.Errors.GetErrors(FormErrorType.SchemaValidation);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator CurGroup = ErrorsList.CreateNavigator().SelectSingleNode(ErrorsGroup, nsMgrErrors);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (FormError err in myErrors)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p&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; //ADDS NEW GROUP ELEMENT&lt;/p&gt;
&lt;p&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; XPathNavigator NewGroup = CurGroup.Clone();&lt;/p&gt;
&lt;p&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; NewGroup.InsertAfter(CurGroup);&lt;/p&gt;
&lt;p&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; errCount = errCount + 1;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&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; //WRITES ERRORDATA TO NEW ERRORNODE&lt;/p&gt;
&lt;p&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;NewGroup.SelectSingleNode(&amp;quot;nsErr:NrErr&amp;quot;, nsMgrErrors).SetValue(errCount.ToString());&lt;/p&gt;
&lt;p&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; NewGroup.SelectSingleNode(&amp;quot;nsErr:ErrMessage&amp;quot;, nsMgrErrors).SetValue(err.Message.ToString());&lt;/p&gt;
&lt;p&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; NewGroup.SelectSingleNode(&amp;quot;nsErr:ErrSiteLocalName&amp;quot;, nsMgrErrors).SetValue(err.Site.LocalName.ToString());&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Other info: Full trust form. Signed with a certificate I&amp;#39;ve generated myself (it has worked before).&amp;nbsp; Cross-Domain Access for User Form Templates is enabled on the server (in case that should be the issue).&lt;/p&gt;
&lt;p&gt;Would you be so kind to assist me?&lt;/p&gt;</description></item></channel></rss>