{"id":499,"date":"2015-07-03T18:25:33","date_gmt":"2015-07-03T12:55:33","guid":{"rendered":"http:\/\/mairwa.com\/wordpress\/?p=499"},"modified":"2015-07-03T18:25:45","modified_gmt":"2015-07-03T12:55:45","slug":"is-form-is-durty","status":"publish","type":"post","link":"http:\/\/mairwa.com\/wordpress\/?p=499","title":{"rendered":"Is form is durty"},"content":{"rendered":"<blockquote><p>function GetFormData() {<\/p>\n<p>oForm.Add(&#8216;span&#8217;, $(&#8216;span:not(:disabled)&#8217;).toEnumerable().ToObject(&#8220;i=&gt;i.attr(&#8216;name&#8217;)&#8221;, &#8220;i=&gt;(i.is(&#8216;:disabled&#8217;)?&#8221;:i.text())&#8221;));<\/p>\n<p>oForm.Add(&#8216;input&#8217;, $(&#8220;input:not(:disabled)&#8221;).toEnumerable().ToObject(&#8220;i=&gt;i.attr(&#8216;name&#8217;)&#8221;, &#8220;i=&gt;i.val()&#8221;));<\/p>\n<p>}<\/p>\n<p>function isModifiedForm(au) {<\/p>\n<p>var oChangeForm = $.Enumerable.Empty().ToDictionary();<\/p>\n<p>oChangeForm.Add(&#8216;span&#8217;, $(&#8216;span:not(:disabled)&#8217;).toEnumerable().ToObject(&#8220;i=&gt;i.attr(&#8216;name&#8217;)&#8221;, &#8220;i=&gt;(i.is(&#8216;:disabled&#8217;)?&#8221;:i.text())&#8221;));<\/p>\n<p>oChangeForm.Add(&#8216;input&#8217;, $(&#8220;input:not(:disabled)&#8221;).toEnumerable().Where(&#8220;i=&gt;i.attr(&#8216;name&#8217;)!=&#8217;tags'&#8221;).ToObject(&#8220;i=&gt;i.attr(&#8216;name&#8217;)&#8221;, &#8220;i=&gt;i.val()&#8221;));<\/p>\n<p>var tempEnumB=Enumerable.From(oChangeForm.Get(&#8220;input&#8221;));<\/p>\n<p>var tempEnumA=Enumerable.From(oChangeForm.Get(&#8220;input&#8221;));<\/p>\n<p>var NoofInputChanged = false;<\/p>\n<p>var NoofSpanChanged = false;<\/p>\n<p>&nbsp;<\/p>\n<p>var hasInputChanges = tempEnumB.Count() != tempEnumA.Count();<\/p>\n<p>if (hasInputChanges) {<\/p>\n<p>NoofInputChanged = tempEnumB.Join(tempEnumA, &#8220;i=&gt;i.Key&#8221;, &#8220;o=&gt;o.Key&#8221;, &#8220;i,o=&gt;{K:i.Key, IsEq:(i.value==o.value)}&#8221;).Where(&#8220;x=&gt;x.IsEq==false&#8221;).Count();<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>tempEnumB=Enumerable.From(oChangeForm.Get(&#8220;span&#8221;));<\/p>\n<p>tempEnumA=Enumerable.From(oChangeForm.Get(&#8220;span&#8221;));<\/p>\n<p>&nbsp;<\/p>\n<p>var hasSpanChanges = tempEnumB.Count() != tempEnumA.Count();<\/p>\n<p>if (hasSpanChanges) {<\/p>\n<p>NoofSpanChanged = tempEnumB.Join(tempEnumA, &#8220;i=&gt;i.Key&#8221;, &#8220;o=&gt;o.Key&#8221;, &#8220;i,o=&gt;{K:i.Key, IsEq:(i.value==o.value)}&#8221;).Where(&#8220;x=&gt;x.IsEq==false&#8221;).Count();<\/p>\n<p>}<\/p>\n<p>if (au) { alert(&#8220;Nothing to save!&#8221;) }<\/p>\n<p>getServerElementById(&#8216;hfDirtyForm&#8217;).value = hasInputChanges || NoofInputChanged || hasSpanChanges || NoofSpanChanged;<\/p>\n<p>return hasInputChanges || NoofInputChanged || hasSpanChanges || NoofSpanChanged;<\/p>\n<p>}<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">function GetFormData() { oForm.Add(&#8216;span&#8217;, $(&#8216;span:not(:disabled)&#8217;).toEnumerable().ToObject(&#8220;i=&gt;i.attr(&#8216;name&#8217;)&#8221;, &#8220;i=&gt;(i.is(&#8216;:disabled&#8217;)?&#8221;:i.text())&#8221;)); oForm.Add(&#8216;input&#8217;, $(&#8220;input:not(:disabled)&#8221;).toEnumerable().ToObject(&#8220;i=&gt;i.attr(&#8216;name&#8217;)&#8221;, &#8220;i=&gt;i.val()&#8221;)); } function isModifiedForm(au) { var oChangeForm = $.Enumerable.Empty().ToDictionary(); oChangeForm.Add(&#8216;span&#8217;, $(&#8216;span:not(:disabled)&#8217;).toEnumerable().ToObject(&#8220;i=&gt;i.attr(&#8216;name&#8217;)&#8221;, &#8220;i=&gt;(i.is(&#8216;:disabled&#8217;)?&#8221;:i.text())&#8221;)); oChangeForm.Add(&#8216;input&#8217;, $(&#8220;input:not(:disabled)&#8221;).toEnumerable().Where(&#8220;i=&gt;i.attr(&#8216;name&#8217;)!=&#8217;tags&#8217;&#8221;).ToObject(&#8220;i=&gt;i.attr(&#8216;name&#8217;)&#8221;, &#8220;i=&gt;i.val()&#8221;)); var tempEnumB=Enumerable.From(oChangeForm.Get(&#8220;input&#8221;)); var tempEnumA=Enumerable.From(oChangeForm.Get(&#8220;input&#8221;)); var NoofInputChanged = false; var NoofSpanChanged = false; &nbsp; var hasInputChanges = tempEnumB.Count() != tempEnumA.Count(); if (hasInputChanges) { NoofInputChanged = tempEnumB.Join(tempEnumA, &#8220;i=&gt;i.Key&#8221;, &#8220;o=&gt;o.Key&#8221;, &#8220;i,o=&gt;{K:i.Key, IsEq:(i.value==o.value)}&#8221;).Where(&#8220;x=&gt;x.IsEq==false&#8221;).Count(); } &nbsp; tempEnumB=Enumerable.From(oChangeForm.Get(&#8220;span&#8221;)); tempEnumA=Enumerable.From(oChangeForm.Get(&#8220;span&#8221;)); &nbsp; var hasSpanChanges =&hellip; <a href=\"http:\/\/mairwa.com\/wordpress\/?p=499\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-499","post","type-post","status-publish","format-standard","hentry","category-jquery","xfolkentry"],"_links":{"self":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=499"}],"version-history":[{"count":1,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/499\/revisions"}],"predecessor-version":[{"id":500,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/499\/revisions\/500"}],"wp:attachment":[{"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=499"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/mairwa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}