{"id":690,"date":"2012-03-21T05:57:57","date_gmt":"2012-03-21T05:57:57","guid":{"rendered":"http:\/\/mahenderpal.wordpress.com\/?p=690"},"modified":"2012-03-21T05:57:57","modified_gmt":"2012-03-21T05:57:57","slug":"show-loading-message-during-function-execution-in-crm-form","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=690","title":{"rendered":"Show Loading message during function execution in CRM Form"},"content":{"rendered":"<p>I found one question in <a href=\"http:\/\/social.microsoft.com\/Forums\/en-US\/crmdevelopment\/thread\/bc8b0f7f-6a25-4a24-9b0c-1a03329de7a0\">CRM Development form<\/a>\u00a0where user asked to show some processing message during long function execution, we have done this in many projects, so I thought to write this post so that it can be help CRM developers. if you are doing some processing or calling any webservice which is taking time to execute\u00a0and you want to show loading messsage to user you can use below function<\/p>\n<p>function showLoadingMessage() {<br \/>\n\u00a0\u00a0\u00a0 tdAreas.style.display = &#8216;none&#8217;;<br \/>\n\u00a0\u00a0\u00a0 var newdiv = document.createElement(&#8216;div&#8217;);<br \/>\n\u00a0\u00a0\u00a0 newdiv.setAttribute(&#8216;id&#8217;, &#8220;msgDiv&#8221;);<br \/>\n\u00a0\u00a0\u00a0 newdiv.valign = &#8220;middle&#8221;;<br \/>\n\u00a0\u00a0\u00a0 newdiv.align = &#8220;center&#8221;;<br \/>\n\u00a0\u00a0\u00a0 var divInnerHTML = &#8220;&lt;table height=&#8217;100%&#8217; width=&#8217;100%&#8217; style=&#8217;cursor:wait&#8217;&gt;&#8221;;<br \/>\n\u00a0\u00a0\u00a0 divInnerHTML += &#8220;&lt;tr&gt;&#8221;;<br \/>\n\u00a0\u00a0\u00a0 divInnerHTML += &#8220;&lt;td valign=&#8217;middle&#8217; align=&#8217;center&#8217;&gt;&#8221;;<br \/>\n\u00a0\u00a0\u00a0 divInnerHTML += &#8220;&lt;img alt=&#8221; src=&#8217;\/_imgs\/AdvFind\/progress.gif&#8217;\/&gt;&#8221;;<br \/>\n\u00a0\u00a0\u00a0 divInnerHTML += &#8220;&lt;div\/&gt;&lt;b&gt;Working&#8230;&lt;\/b&gt;&#8221;;<br \/>\n\u00a0\u00a0\u00a0 divInnerHTML += &#8220;&lt;\/td&gt;&lt;\/tr&gt;&lt;\/table&gt;&#8221;;<br \/>\n\u00a0\u00a0\u00a0 newdiv.innerHTML = divInnerHTML;<br \/>\n\u00a0\u00a0\u00a0 newdiv.style.background = &#8216;#FFFFFF&#8217;;<br \/>\n\u00a0\u00a0\u00a0 newdiv.style.fontSize = &#8220;15px&#8221;;<br \/>\n\u00a0\u00a0\u00a0 newdiv.style.zIndex = &#8220;1010&#8221;;<br \/>\n\u00a0\u00a0\u00a0 newdiv.style.width = document.body.clientWidth;<br \/>\n\u00a0\u00a0\u00a0 newdiv.style.height = document.body.clientHeight;<br \/>\n\u00a0\u00a0\u00a0 newdiv.style.position = &#8216;absolute&#8217;;<br \/>\n\u00a0\u00a0\u00a0 document.body.insertBefore(newdiv, document.body.firstChild);<br \/>\n\u00a0\u00a0\u00a0 document.all.msgDiv.style.visibility = &#8216;visible&#8217;;<br \/>\n}<\/p>\n<p>it will display message like below<\/p>\n<p><a href=\"http:\/\/mahenderpal.files.wordpress.com\/2012\/03\/loadingmessage.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-692\" title=\"loadingMessage\" src=\"http:\/\/mahenderpal.files.wordpress.com\/2012\/03\/loadingmessage.png\" alt=\"\" width=\"260\" height=\"112\" \/><\/a><\/p>\n<p>once processing is done you can hide this message using below code<\/p>\n<p>document.all.msgDiv.style.visibility = &#8216;hidden&#8217;;<\/p>\n<p>Enjoy !!!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I found one question in CRM Development form\u00a0where user asked to show some processing message during long function execution, we have done this in many projects, so I thought to write this post so that it can be help CRM developers. if you are doing some processing or calling any webservice which is taking time to execute\u00a0and you want to&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=690\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[24,5,10],"tags":[],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/690"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=690"}],"version-history":[{"count":0,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/690\/revisions"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}