Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added some code for usage along with wicket 6

...

This code has been tested on both IE and Firefox (06/2008).

with Wicket 6 one can use the following code

Code Block

<script type="text/javascript">
 window.onload = setupFunc;

 function setupFunc() {
   document.getElementsByTagName('body')[0].onclick = clickFunc;
   hideBusysign();
   Wicket.Event.subscribe('/ajax/call/beforeSend', function( attributes, jqXHR, settings ) {
	   showBusysign()
	    });
   Wicket.Event.subscribe('/ajax/call/complete', function( attributes, jqXHR, textStatus) {
	   hideBusysign()
	    });
 }

 function hideBusysign() {
   document.getElementById('ajaxveil').style.display ='none';
 }

 function showBusysign() {
   document.getElementById('ajaxveil').style.display ='inline';
 }

 function clickFunc(eventData) {
   var clickedElement = (window.event) ? event.srcElement : eventData.target;
   if ((clickedElement.tagName.toUpperCase() == 'BUTTON' || clickedElement.tagName.toUpperCase() == 'A' || clickedElement.parentNode.tagName.toUpperCase() == 'A'
     || (clickedElement.tagName.toUpperCase() == 'INPUT' && (clickedElement.type.toUpperCase() == 'BUTTON' || clickedElement.type.toUpperCase() == 'SUBMIT'))) 
     && clickedElement.parentNode.id.toUpperCase() != 'NOBUSY' ) {
     showBusysign();
   }
 }
</script>
</head>
<body>
  <div id="ajaxveil">
   <h1>&nbsp;&nbsp; ... &nbsp;&nbsp;</h1> 
   </div>

Special circumstances

For example, if you redirect to external pages, you must skip the busy
indicator. This means that you might have to use some clue in your
button or link to omit the busy indicator.

...