Hi!

Did I misunderstand something? I am not a javascript-wizard ;) I could
make it work perfectly with non-ajax buttons and links but it does not
seem to react to wicket ajax buttons.

Here is the script code, pls take a look if there is a blatant bug (I
assumed I do not need to make any modifications onto the server side):

<script type="text/javascript">
  /*
   * <div id="busysign">Loading ...</div>
   */
  window.onload = setupFunc;

  Wicket.Ajax.registerPreCallHandler(showBusysign());
  Wicket.Ajax.registerPostCallHandler(hideBusysign());
  Wicket.Ajax.registerFailureHandler(hideBusysign());

  function setupFunc() {
    document.getElementsByTagName('body')[0].onclick = clickFunc;
    hideBusysign();
  }

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

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

  function clickFunc(eventData) {
    var clickedElement = (window.event) ? event.srcElement : eventData.target;
    if (clickedElement.tagName == 'BUTTON' || clickedElement.tagName
== 'A' || clickedElement.parentNode.tagName == 'A'
      || (clickedElement.tagName == 'INPUT' && (clickedElement.type ==
'BUTTON' || clickedElement.type == 'SUBMIT'))) {
      showBusysign();
    }
  }
</script>


**
Martin

2008/6/7 Peter Thomas <[EMAIL PROTECTED]>:
> On Sat, Jun 7, 2008 at 9:47 PM, Igor Vaynberg <[EMAIL PROTECTED]>
> wrote:
>
>> wicket supports global javascript event handlers for this. either
>> search the list or look inside wicet-ajax.js, i cant recall them off
>> the top of my head.
>>
>
> They are mentioned in this thread:
>
> http://www.nabble.com/Re%3A-ajax-progress-indicator-p17020185.html
>
>
>>
>> -igor
>>
>> On Sat, Jun 7, 2008 at 8:59 AM, Martin Makundi
>> <[EMAIL PROTECTED]> wrote:
>> > Hi!
>> >
>> > I am trying to maneuvre a lightweight gmail-style busy indicator to
>> > stay in place whenever I click an operative button.
>> >
>> > The script seems to work fine with regular submit buttons, but I have
>> > not found a proper way to reset the indicator in context with ajax
>> > buttons and links.
>> >
>> > Is there an event I could bind this to, or do I have to push some
>> > javascript from the server side / tweak the wicket-ajax.js? It would
>> > be pretty nice if I could just overload/hook-to something on
>> > javascript level.
>> >
>> > Here is my code:
>> >
>> > <style type="text/css">
>> > #busysign {
>> >  display: none;
>> >  float: right;
>> >  background: red;
>> >  margin-top: 5px;
>> >  margin-right: 5px;
>> >  z-index: 1000;
>> >  width: 200;
>> >  font-weight: bold;
>> >  text-align: center;
>> >  font-size: 1.3em;
>> > }
>> > </style>
>> > <script type="text/javascript">
>> >  window.onload = setupFunc;
>> >
>> >  function setupFunc() {
>> >    document.getElementsByTagName('body')[0].onclick = clickFunc;
>> >  }
>> >
>> >  function clickFunc(eventData) {
>> >    var clickedElement = (window.event) ? event.srcElement :
>> eventData.target;
>> >    if (clickedElement.tagName == 'BUTTON'
>> >      || (clickedElement.tagName == 'INPUT' && (clickedElement.type ==
>> > 'button' || clickedElement.type == 'submit'))) {
>> >      document.getElementById('busysign').style.display ='inline';
>> >    }
>> >  }
>> > </script>
>> >
>> >
>> > I would equally well appreciate if you had some alternative generic
>> > lightweight solution :)
>> >
>> >
>> > **
>> > Martin
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to