Re: Lightweight generic busy indicator
Hello, I put this code into my application and its very non-intrusive and easy to use. I found a slight problem with it though that I am able to replicate but not able to fix. It happens when a page using a form is loaded through the browsers url directly, instead of through a link in the application. So for instance if a user bookmarks a form, or opens a browser and types in the form url, when the form is submitted the indicator displays as it should, but it does not ever hide when the request is finished. In my instance I am submitting the form through ajax with validation errors, and the validation messages come back as they should but the indicator doesn't hide. I've tried putting the js outside of the html head tag, but it didn't seem to help. Interestingly enough, if I type the url and go to the form, and click refresh once, it works fine again. Almost like for some reason it can't be used on the page that creates the users session. Any ideas about this? Martin Makundi wrote: Hi! I put it into the Reference Library - Ajax as Generic Busy Indicator (for both Ajax and non-Ajax submits) http://cwiki.apache.org/confluence/display/WICKET/Generic+Busy+Indicator+%28for+both+Ajax+and+non-Ajax+submits%29 -- View this message in context: http://www.nabble.com/Lightweight-generic-busy-indicator-tp17710292p20399357.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Lightweight generic busy indicator
I must say that in my experience, 'worksforme'. Whenever I have had problems with the indicator it has been because the javascript has crashed. You can debug the javascript by putting alert('Hello'); in some places you want to debug. This will quickly show you which parts of the javascript really get executed and which parts do not. ** Martin 2008/11/8 fatefree [EMAIL PROTECTED]: Hello, I put this code into my application and its very non-intrusive and easy to use. I found a slight problem with it though that I am able to replicate but not able to fix. It happens when a page using a form is loaded through the browsers url directly, instead of through a link in the application. So for instance if a user bookmarks a form, or opens a browser and types in the form url, when the form is submitted the indicator displays as it should, but it does not ever hide when the request is finished. In my instance I am submitting the form through ajax with validation errors, and the validation messages come back as they should but the indicator doesn't hide. I've tried putting the js outside of the html head tag, but it didn't seem to help. Interestingly enough, if I type the url and go to the form, and click refresh once, it works fine again. Almost like for some reason it can't be used on the page that creates the users session. Any ideas about this? Martin Makundi wrote: Hi! I put it into the Reference Library - Ajax as Generic Busy Indicator (for both Ajax and non-Ajax submits) http://cwiki.apache.org/confluence/display/WICKET/Generic+Busy+Indicator+%28for+both+Ajax+and+non-Ajax+submits%29 -- View this message in context: http://www.nabble.com/Lightweight-generic-busy-indicator-tp17710292p20399357.html Sent from the Wicket - User mailing list archive at Nabble.com. - 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]
Re: Lightweight generic busy indicator
Ok. So I finally figured out my javascript syntax mistake. Do not use Wicket.Ajax.registerPreCallHandler(showBusysign()) but instead without the brackets with the function: Wicket.Ajax.registerPreCallHandler(showBusysign); This snipplet is now complete and can be used with any application: script type=text/javascript /* Your web page must contain this: * div id=busysignLoading .../div */ window.onload = setupFunc; function setupFunc() { document.getElementsByTagName('body')[0].onclick = clickFunc; hideBusysign(); Wicket.Ajax.registerPreCallHandler(showBusysign); Wicket.Ajax.registerPostCallHandler(hideBusysign); Wicket.Ajax.registerFailureHandler(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 Do you think I should add it to the WIKI? ** Martin 2008/6/8 Martin Makundi [EMAIL PROTECTED]: Hi! In my understanding it should (IMHO) be possible to hook all ajax calls without doing anything on the server side. I think your add onClick to an AjaxButton issue involves attaching specific javascript (from the server side) to a specific button. That's not what I need, is it? I would have to roll out a new global ajax button having the amendmentsno. That's an overkill (is it the only solution???). I just want the indicator to become visible whenever any ajax request starts and the indicator to be again hidden whenever the ajax request stops/terminates. I do not want to affect the ajax behavior itself, I just want to add one intermediate function call. There should be a generic clicent-side (browser) hook or way to tweak this. I tried chaning the body onload setupfunc to the following, which had the result that all ajaxfallbackbuttons fell back into normal mode: function setupFunc() { document.getElementsByTagName('body')[0].onclick = clickFunc; hideBusysign(); Wicket.Ajax.registerPreCallHandler(showBusysign()); Wicket.Ajax.registerPostCallHandler(hideBusysign()); Wicket.Ajax.registerFailureHandler(hideBusysign()); } So I just want to add the show/hideBusysign in addition to the existing functionality. Do I have to fork wicket-ajax.js or is it possible to achieve it using scripting within the markup file? ** Martin 2008/6/8 Eyal Golan [EMAIL PROTECTED]: check my posts on add onClick to an AjaxButton in the users list (I couldn't get the URL for it ...) It seems that you have a similar problem. Eyal On Sat, Jun 7, 2008 at 11:41 PM, Martin Makundi [EMAIL PROTECTED] wrote: 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=busysignLoading .../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
Re: Lightweight generic busy indicator
Martin Makundi wrote: Ok. So I finally figured out my javascript syntax mistake. Do not use Wicket.Ajax.registerPreCallHandler(showBusysign()) but instead without the brackets with the function: Wicket.Ajax.registerPreCallHandler(showBusysign); Yes because calling it with brackets, does actually call the showBusysign method and gives the result to registerPreCallHandler.. Doing with out brackets passes the method as wanted. This snipplet is now complete and can be used with any application: script type=text/javascript /* Your web page must contain this: * div id=busysignLoading .../div */ window.onload = setupFunc; function setupFunc() { document.getElementsByTagName('body')[0].onclick = clickFunc; hideBusysign(); Wicket.Ajax.registerPreCallHandler(showBusysign); Wicket.Ajax.registerPostCallHandler(hideBusysign); Wicket.Ajax.registerFailureHandler(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 Do you think I should add it to the WIKI? Thats a great idea, the more info the better:) ** Martin 2008/6/8 Martin Makundi [EMAIL PROTECTED]: Hi! In my understanding it should (IMHO) be possible to hook all ajax calls without doing anything on the server side. I think your add onClick to an AjaxButton issue involves attaching specific javascript (from the server side) to a specific button. That's not what I need, is it? I would have to roll out a new global ajax button having the amendmentsno. That's an overkill (is it the only solution???). I just want the indicator to become visible whenever any ajax request starts and the indicator to be again hidden whenever the ajax request stops/terminates. I do not want to affect the ajax behavior itself, I just want to add one intermediate function call. There should be a generic clicent-side (browser) hook or way to tweak this. I tried chaning the body onload setupfunc to the following, which had the result that all ajaxfallbackbuttons fell back into normal mode: function setupFunc() { document.getElementsByTagName('body')[0].onclick = clickFunc; hideBusysign(); Wicket.Ajax.registerPreCallHandler(showBusysign()); Wicket.Ajax.registerPostCallHandler(hideBusysign()); Wicket.Ajax.registerFailureHandler(hideBusysign()); } So I just want to add the show/hideBusysign in addition to the existing functionality. Do I have to fork wicket-ajax.js or is it possible to achieve it using scripting within the markup file? ** Martin 2008/6/8 Eyal Golan [EMAIL PROTECTED]: check my posts on add onClick to an AjaxButton in the users list (I couldn't get the URL for it ...) It seems that you have a similar problem. Eyal On Sat, Jun 7, 2008 at 11:41 PM, Martin Makundi [EMAIL PROTECTED] wrote: 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=busysignLoading .../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:
Re: Lightweight generic busy indicator
Do you think I should add it to the WIKI? Thats a great idea, the more info the better:) I had a look at the wicket wiki: http://cwiki.apache.org/WICKET/#Index-FrameworkDocumentation Would you consider it it the right place or would you suggest a more suitable location (and would that require any special publishing rights)? ** Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Lightweight generic busy indicator
I think somewhere here: http://cwiki.apache.org/WICKET/faqs.html ? Martin Makundi wrote: Do you think I should add it to the WIKI? Thats a great idea, the more info the better:) I had a look at the wicket wiki: http://cwiki.apache.org/WICKET/#Index-FrameworkDocumentation Would you consider it it the right place or would you suggest a more suitable location (and would that require any special publishing rights)? ** Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Wicket for love Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Lightweight generic busy indicator
Hi! I put it into the Reference Library - Ajax as Generic Busy Indicator (for both Ajax and non-Ajax submits) http://cwiki.apache.org/confluence/display/WICKET/Generic+Busy+Indicator+%28for+both+Ajax+and+non-Ajax+submits%29 ** Martin 2008/6/9 Gwyn Evans [EMAIL PROTECTED]: I'd have thought that either under the AJAX or the View layer topics in the Reference Library[1] page. If so, go to the 'topic' page for the one you choose ([2] or [3]) and Add page your own page which should then automatically appear in the lists. If you've already created a page, it's not a problem as it's possible to move it around. As for which one to use, which would you look for it under? /Gwyn [1] http://cwiki.apache.org/WICKET/reference-library.html [2] http://cwiki.apache.org/WICKET/ajax.html [3] http://cwiki.apache.org/WICKET/view-layer.html On Mon, Jun 9, 2008 at 9:50 AM, Martin Makundi [EMAIL PROTECTED] wrote: Do you think I should add it to the WIKI? Thats a great idea, the more info the better:) I had a look at the wicket wiki: http://cwiki.apache.org/WICKET/#Index-FrameworkDocumentation Would you consider it it the right place or would you suggest a more suitable location (and would that require any special publishing rights)? ** 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]
Re: Lightweight generic busy indicator
check my posts on add onClick to an AjaxButton in the users list (I couldn't get the URL for it ...) It seems that you have a similar problem. Eyal On Sat, Jun 7, 2008 at 11:41 PM, Martin Makundi [EMAIL PROTECTED] wrote: 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=busysignLoading .../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] -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74
Re: Lightweight generic busy indicator
Hi! In my understanding it should (IMHO) be possible to hook all ajax calls without doing anything on the server side. I think your add onClick to an AjaxButton issue involves attaching specific javascript (from the server side) to a specific button. That's not what I need, is it? I would have to roll out a new global ajax button having the amendmentsno. That's an overkill (is it the only solution???). I just want the indicator to become visible whenever any ajax request starts and the indicator to be again hidden whenever the ajax request stops/terminates. I do not want to affect the ajax behavior itself, I just want to add one intermediate function call. There should be a generic clicent-side (browser) hook or way to tweak this. I tried chaning the body onload setupfunc to the following, which had the result that all ajaxfallbackbuttons fell back into normal mode: function setupFunc() { document.getElementsByTagName('body')[0].onclick = clickFunc; hideBusysign(); Wicket.Ajax.registerPreCallHandler(showBusysign()); Wicket.Ajax.registerPostCallHandler(hideBusysign()); Wicket.Ajax.registerFailureHandler(hideBusysign()); } So I just want to add the show/hideBusysign in addition to the existing functionality. Do I have to fork wicket-ajax.js or is it possible to achieve it using scripting within the markup file? ** Martin 2008/6/8 Eyal Golan [EMAIL PROTECTED]: check my posts on add onClick to an AjaxButton in the users list (I couldn't get the URL for it ...) It seems that you have a similar problem. Eyal On Sat, Jun 7, 2008 at 11:41 PM, Martin Makundi [EMAIL PROTECTED] wrote: 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=busysignLoading .../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
Re: Lightweight generic busy indicator
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. -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]
Re: Lightweight generic busy indicator
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]
Re: Lightweight generic busy indicator
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=busysignLoading .../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]