<?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: Repeating Table Event Handler</title><link>https://www.infopathdev.com:443/forums/thread/13400.aspx</link><pubDate>Thu, 04 Aug 2005 13:39:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13400</guid><dc:creator>smaur</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13400.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13400</wfw:commentRss><description>Thanks to Agni, this now works,&lt;br /&gt;&lt;br /&gt;function msoxd_d_lkpComments::OnBeforeChange(eventObj)&lt;br /&gt;{&lt;br /&gt;	var oNetwork = new ActiveXObject("WScript.Network");&lt;br /&gt;	var strUserName = oNetwork.UserName;&lt;br /&gt;	&lt;br /&gt;		if (eventObj.Operation == "Delete" &amp;&amp; eventObj.Site == eventObj.Source &amp;&amp; eventObj.NewValue == null &amp;&amp; strUserName != eventObj.Source.selectSingleNode("@CommentBy").text)&lt;br /&gt;			{&lt;br /&gt;			eventObj.ReturnStatus = false;&lt;br /&gt;			eventObj.ReturnMessage = "You cannot remove a comment entered by someone else";&lt;br /&gt;			}&lt;br /&gt;				&lt;br /&gt;		else&lt;br /&gt;			{&lt;br /&gt;			//allow deletion&lt;br /&gt;			}&lt;br /&gt;}</description></item><item><title>Re: Repeating Table Event Handler</title><link>https://www.infopathdev.com:443/forums/thread/13399.aspx</link><pubDate>Fri, 29 Jul 2005 18:18:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13399</guid><dc:creator>smaur</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13399.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13399</wfw:commentRss><description>Agni,&lt;br /&gt;Thanks for your help.&lt;br /&gt;I corrected the code as you suggested,&lt;br /&gt;&lt;br /&gt;The problem now is that my test for&lt;br /&gt;strUserName == DataDOMEvent.Source.selectSingleNode("@CommentBy").text&lt;br /&gt;always results in True.&lt;br /&gt;That is if the current UserName appears even once in the @CommentBy field in the repeating table, then he can delete any repeating table entry. My intent was to allow a user to delete only the comments which he has entered.&lt;br /&gt;The only time a user is prevented from deleting a comment is when he has not made a single comment.&lt;br /&gt;&lt;br /&gt;Perhaps I don't fully understand the capabilities/limits of the repeating table control. If the user has selected a particular line in the repeating table, is there a way to extract a piece of data in a field on the line that currently has the focus and then do a comparison with that single data point?&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Re: Repeating Table Event Handler</title><link>https://www.infopathdev.com:443/forums/thread/13398.aspx</link><pubDate>Thu, 28 Jul 2005 22:27:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13398</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13398.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13398</wfw:commentRss><description>I am sorry smaur, i made a mistake in my code, here is the actual code that will work for &lt;br /&gt;DataDOMEvent.Source.selectSingleNode("@CommentBy").text&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Agni&lt;br /&gt;InfoPath Dev India</description></item><item><title>Re: Repeating Table Event Handler</title><link>https://www.infopathdev.com:443/forums/thread/13397.aspx</link><pubDate>Thu, 28 Jul 2005 20:31:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13397</guid><dc:creator>smaur</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13397.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13397</wfw:commentRss><description>Thanks for your reply Agni,&lt;br /&gt;If I understand correctly, I should replace the full path statement I am currently using:&lt;br /&gt;XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:tblRequests/lkpComments/@CommentBy").text)&lt;br /&gt;with:&lt;br /&gt;XDocument.DOM.selectSingleNode(DataDOMEvent.Source, "@CommentBy").text&lt;br /&gt;...but when I do this I get an error stating...&lt;br /&gt;Wrong number of arguments or invalid property assignment&lt;br /&gt;File:script.js&lt;br /&gt;Line:208&lt;br /&gt;&lt;br /&gt;where line 208 is the line witht the path.&lt;br /&gt;&lt;br /&gt;I appreciate your help.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Re: Repeating Table Event Handler</title><link>https://www.infopathdev.com:443/forums/thread/13396.aspx</link><pubDate>Thu, 28 Jul 2005 19:15:38 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13396</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13396.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13396</wfw:commentRss><description>Hi smaur,&lt;br /&gt;My guess is you are having OnBeforeChange on "lkpComments" node&lt;br /&gt;Here instead of using full xpath you just need to use "@CommentBy" xpath on DataDOMEvent.Source node&lt;br /&gt;XDocument.DOM.selectSingleNode(DataDOMEvent.Source, "@CommentBy").text&lt;br /&gt;&lt;br /&gt;Agni&lt;br /&gt;InfoPath Dev India</description></item><item><title>Repeating Table Event Handler</title><link>https://www.infopathdev.com:443/forums/thread/12512.aspx</link><pubDate>Wed, 27 Jul 2005 20:24:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12512</guid><dc:creator>smaur</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12512.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12512</wfw:commentRss><description>I have a form based on an Access database. The database has a main table (called tblRequests) to which users can submit data. The main table has a one to many with a second table (repeating table called lkpComments). On my form I show one record from the main table, and many records (comments) from the second table). Users can add comments at will, but I want to prevent a user from deleting a comment that belongs to someone else. Therefore, my comments table includes a field titled "CommentBy" which holds the name of the person who originally entered it.&lt;br /&gt;I want to be able to compare the current UserName with the name in the CommentBy field of the repeating table entry that currently has focus so that I can prevent it's deletion.&lt;br /&gt;This is what I have so far, but there is something wrong with my reference to the @CommentBy field. (I think it is because I need to somehow refer to the specific "comment" entry that has the focus).&lt;br /&gt;Any ideas? Thanks!&lt;br /&gt;&lt;br /&gt;function msoxd_d_lkpComments::OnBeforeChange(DataDOMEvent)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;//determine the current user&lt;br /&gt;var oNetwork = new ActiveXObject("WScript.Network");&lt;br /&gt;var strUserName = oNetwork.UserName;&lt;br /&gt;&lt;br /&gt;//check to see if the current user is the owner of the comment&lt;br /&gt;if (strUserName == XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:tblRequests/lkpComments/@CommentBy").text)&lt;br /&gt;  {&lt;br /&gt;     //allow deletion of the record&lt;br /&gt;  }&lt;br /&gt;else&lt;br /&gt;     //prevent deletion of the record&lt;br /&gt;	if (DataDOMEvent.Operation == "Delete" &amp;&amp; DataDOMEvent.Site == DataDOMEvent.Source &amp;&amp; DataDOMEvent.NewValue == null)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;DataDOMEvent.ReturnStatus = false;&lt;br /&gt;DataDOMEvent.ReturnMessage = "You cannot delete this record";&lt;br /&gt;}&lt;br /&gt;}</description></item></channel></rss>