Need a "Please Wait" pop up window for catalog item

davehurley
Giga Contributor

Hi All,

I'm calling a script include that can take about a minute to run (it's a doozy, but necessary), which is being fired from an onchange script in a catalog item. It's a very simple form and so it's quite possible that a user will complete it before the script is complete. I'd like to add an alert that fires either on the onchange or perhaps onsubmit and stays up until the include has returned a value. I'm sure it's possible, we've got something similar that happens within our cart, but I haven't had any luck figuring it out. Your help is much appreciated.

1 ACCEPTED SOLUTION

davehurley
Giga Contributor

Thanks, guys. I ended up stumbling onto the Custom Dialog article and it works great. Much like the OOB showLoadingDialog():



var gdw = new GlideDialogWindow('show_list');

      gdw.setTitle('Gimme a second. Sheesh.');


      gdw.setSize(100,300);


      gdw.render();



::insert code::



      gdw.destroy();


View solution in original post

5 REPLIES 5

ahaz86
Mega Guru

Edit: The solution below is best especially if you do not need any customization



I think you would need to add a custom element to the screen. something like this may work for you


call this when you make the ajax call


var iframeDiv = document.createElement('div');


  iframeDiv.id = "popupFrameDiv";


  document.body.appendChild(iframeDiv);


  document.getElementById('popupFrameDiv').innerHTML = '<div id="popupFrameDivBG" style="background-color: rgba(0, 0, 0, 0.8);position: fixed;width: 100%;height: 100%;top: 0;text-align:center;padding-top:20px;"><div style="border-radius:10px;padding:10px;width:500px;background:#fff;height:300px;margin: 0 auto;font-size:20px">Please wait while the data is loaded.</div></div>';



and this after you have gotten the data


document.getElementById('popupFrameDiv').parentNode.removeChild(elem)


Anurag Tripathi
Mega Patron
Mega Patron

Hi David,



Try this simple thing on client scripts


Where you have to start the popup, just write this


showLoadingDialog();  




when you have to close it, write this.


hideLoadingDialog();




Somple OOB solution.


-Anurag

davehurley
Giga Contributor

Thanks, guys. I ended up stumbling onto the Custom Dialog article and it works great. Much like the OOB showLoadingDialog():



var gdw = new GlideDialogWindow('show_list');

      gdw.setTitle('Gimme a second. Sheesh.');


      gdw.setSize(100,300);


      gdw.render();



::insert code::



      gdw.destroy();


i like the title


-Anurag