locked
Display icon or log during javascript execution RRS feed

  • Question

  • I have made some operation in javascript.

    The script start from a PhoneCall Form and process some invoice data.

    The script run well but the execution is 30/35 seconds

    How i can display a wait image or a temp div where display some message during the execution so the user know who the system is working

    Thanks

    Lorenzo Soncini


    LSo Lorenzo Soncini Trento TN - Italy

    Tuesday, March 20, 2012 3:06 PM

Answers

  • Hi,

    you can use below script to show loading message

    function showLoadingMessage() {
        tdAreas.style.display = 'none';
        var newdiv = document.createElement('div');
        newdiv.setAttribute('id', "msgDiv");
        newdiv.valign = "middle";
        newdiv.align = "center";
        var divInnerHTML = "<table height='100%' width='100%' style='cursor:wait'>";
        divInnerHTML += "<tr>";
        divInnerHTML += "<td valign='middle' align='center'>";
        divInnerHTML += "<img alt='' src='/_imgs/AdvFind/progress.gif'/>";
        divInnerHTML += "<div/><b>Working...</b>";
        divInnerHTML += "</td></tr></table>";
        newdiv.innerHTML = divInnerHTML;
        newdiv.style.background = '#FFFFFF';
        newdiv.style.fontSize = "15px";
        newdiv.style.zIndex = "1010";
        newdiv.style.width = document.body.clientWidth;
        newdiv.style.height = document.body.clientHeight;
        newdiv.style.position = 'absolute';
        document.body.insertBefore(newdiv, document.body.firstChild);
        document.all.msgDiv.style.visibility = 'visible';
    }

    you can call below statement onec your processing is completed

    document.all.msgDiv.style.visibility = 'hidden';


    Mahain : Check My Blog
    Follow me on Twitter
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Tuesday, March 20, 2012 4:21 PM
    Moderator

All replies

  • Hi,

    you can use below script to show loading message

    function showLoadingMessage() {
        tdAreas.style.display = 'none';
        var newdiv = document.createElement('div');
        newdiv.setAttribute('id', "msgDiv");
        newdiv.valign = "middle";
        newdiv.align = "center";
        var divInnerHTML = "<table height='100%' width='100%' style='cursor:wait'>";
        divInnerHTML += "<tr>";
        divInnerHTML += "<td valign='middle' align='center'>";
        divInnerHTML += "<img alt='' src='/_imgs/AdvFind/progress.gif'/>";
        divInnerHTML += "<div/><b>Working...</b>";
        divInnerHTML += "</td></tr></table>";
        newdiv.innerHTML = divInnerHTML;
        newdiv.style.background = '#FFFFFF';
        newdiv.style.fontSize = "15px";
        newdiv.style.zIndex = "1010";
        newdiv.style.width = document.body.clientWidth;
        newdiv.style.height = document.body.clientHeight;
        newdiv.style.position = 'absolute';
        document.body.insertBefore(newdiv, document.body.firstChild);
        document.all.msgDiv.style.visibility = 'visible';
    }

    you can call below statement onec your processing is completed

    document.all.msgDiv.style.visibility = 'hidden';


    Mahain : Check My Blog
    Follow me on Twitter
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Tuesday, March 20, 2012 4:21 PM
    Moderator
  • Thanks for the post  Mahender

    Learned something new ...

    cheers

    Dkay

    Tuesday, March 20, 2012 4:33 PM
  • This looks helpful, but how would I know that the processing has been completed ?
    Wednesday, March 21, 2012 9:19 AM
  • hi.. I am a novice to the CRM. Can you please help me with the other details related to this code including where to write this code?

    How do i add the loading image - _imgs/AdvFind/progress.gif? Or does this exist by default?

    Do I need to add this as webresource script? If yes, then when and how to call this showLoadingMessage() function?

    I already have a loading image and text showing up every time which exactly has the same path as you are using in this example, but i want to change the styling of the background of this image. I am not sure how the loading image is displayed currently in my project.

    Please provide some more inputs.

    Veena

    Thursday, November 14, 2013 9:07 AM