Re: Add onClick to an AjaxButton
No, We're on 1.3.3 Nice though :) when we move to 1.4, I'll try to remember using it as well. Thanks On Wed, Jun 4, 2008 at 6:15 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: are you on 1.4, i checked in a change that will allow ajaxbutton to utilize getonclickscript() within the ajax handler it generates... -igor On Tue, Jun 3, 2008 at 2:47 AM, Eyal Golan [EMAIL PROTECTED] wrote: One more thing. If I understand correctly, AjaxButton should override the getOnClickScript() method, return null and be declared final. What to you people think? -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 - 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
Add onClick to an AjaxButton
Hello all, We have a StyledAjaxButton that extends AjaxButton. We want to add a confirmation when clicking. We added this: @Override protected String getOnClickScript() { String warning = LocalizationHelper.getMessage(page.confirmation.message, DELETE_TICKETS); return if (!window.confirm('+warning+')) return false;; } Now, in a normal Button it works. But in the AjaxButton it does not. I checked the AjaxButton and saw that an AjaxFormSubmitBehavior is added to it with an onClick. How can I add another behavior like this? Or how can I tackle this problem? Thanks -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74
Re: Add onClick to an AjaxButton
hmm, just add it to the ajaxrequesttarget instead... target.prependJavascript(javascript) ? Not sure if this does the trick though. Eyal Golan wrote: Hello all, We have a StyledAjaxButton that extends AjaxButton. We want to add a confirmation when clicking. We added this: @Override protected String getOnClickScript() { String warning = LocalizationHelper.getMessage(page.confirmation.message, DELETE_TICKETS); return if (!window.confirm('+warning+')) return false;; } Now, in a normal Button it works. But in the AjaxButton it does not. I checked the AjaxButton and saw that an AjaxFormSubmitBehavior is added to it with an onClick. How can I add another behavior like this? Or how can I tackle this problem? Thanks -- -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: Add onClick to an AjaxButton
Thanks Nino, first phase is done. I get the error message. My code is like this: In the AjaxButton: @Override protected void onSubmit(AjaxRequestTarget target, Form form) { String warning = LocalizationHelper.getMessage(page.confirmation.message); String confirmJS = window.confirm('+warning+'); target.prependJavascript(confirmJS); target.addComponent(resultLabel); try { getTicketManager().deleteAllTickets(); succeeded = true; setResult(LocalizationHelper.getMessage(page.admin.successMessage)); } catch (Throwable t) { succeeded = false; setResult(LocalizationHelper.getMessage(page.admin.failureMessage)); } } My problem, of course, is that I still delete the tickets (in getTicketManager().deleteAllTickets();). How can I check the script's result and according to this decide what to do? On Tue, Jun 3, 2008 at 12:18 PM, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] wrote: hmm, just add it to the ajaxrequesttarget instead... target.prependJavascript(javascript) ? Not sure if this does the trick though. Eyal Golan wrote: Hello all, We have a StyledAjaxButton that extends AjaxButton. We want to add a confirmation when clicking. We added this: @Override protected String getOnClickScript() { String warning = LocalizationHelper.getMessage(page.confirmation.message, DELETE_TICKETS); return if (!window.confirm('+warning+')) return false;; } Now, in a normal Button it works. But in the AjaxButton it does not. I checked the AjaxButton and saw that an AjaxFormSubmitBehavior is added to it with an onClick. How can I add another behavior like this? Or how can I tackle this problem? Thanks -- -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] -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74
Re: Add onClick to an AjaxButton
I have created a behavior (WIP), which takes care of that: http://svn2.assembla.com/svn/planningpoker/trunk/planningpoker-wicket/src/main/java/org/planningpoker/wicket/behaviours/ClickConfirmBehavior.java Frank On Tue, Jun 3, 2008 at 11:01 AM, Eyal Golan [EMAIL PROTECTED] wrote: Hello all, We have a StyledAjaxButton that extends AjaxButton. We want to add a confirmation when clicking. We added this: @Override protected String getOnClickScript() { String warning = LocalizationHelper.getMessage(page.confirmation.message, DELETE_TICKETS); return if (!window.confirm('+warning+')) return false;; } Now, in a normal Button it works. But in the AjaxButton it does not. I checked the AjaxButton and saw that an AjaxFormSubmitBehavior is added to it with an onClick. How can I add another behavior like this? Or how can I tackle this problem? Thanks -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74
Re: Add onClick to an AjaxButton
One more thing. If I understand correctly, AjaxButton should override the getOnClickScript() method, return null and be declared final. What to you people think? -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74
Re: Add onClick to an AjaxButton
Thanks Frank, It is exactly what I needed. cheers :) On Tue, Jun 3, 2008 at 1:00 PM, Frank Bille [EMAIL PROTECTED] wrote: I have created a behavior (WIP), which takes care of that: http://svn2.assembla.com/svn/planningpoker/trunk/planningpoker-wicket/src/main/java/org/planningpoker/wicket/behaviours/ClickConfirmBehavior.java Frank On Tue, Jun 3, 2008 at 11:01 AM, Eyal Golan [EMAIL PROTECTED] wrote: Hello all, We have a StyledAjaxButton that extends AjaxButton. We want to add a confirmation when clicking. We added this: @Override protected String getOnClickScript() { String warning = LocalizationHelper.getMessage(page.confirmation.message, DELETE_TICKETS); return if (!window.confirm('+warning+')) return false;; } Now, in a normal Button it works. But in the AjaxButton it does not. I checked the AjaxButton and saw that an AjaxFormSubmitBehavior is added to it with an onClick. How can I add another behavior like this? Or how can I tackle this problem? Thanks -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74
RE: Add onClick to an AjaxButton
Declare nothing final unless trying to solve a particular problem. ...m2c - Brill Pappin -Original Message- From: Eyal Golan [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2008 5:47 AM To: users@wicket.apache.org Subject: Re: Add onClick to an AjaxButton One more thing. If I understand correctly, AjaxButton should override the getOnClickScript() method, return null and be declared final. What to you people think? -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Add onClick to an AjaxButton
are you on 1.4, i checked in a change that will allow ajaxbutton to utilize getonclickscript() within the ajax handler it generates... -igor On Tue, Jun 3, 2008 at 2:47 AM, Eyal Golan [EMAIL PROTECTED] wrote: One more thing. If I understand correctly, AjaxButton should override the getOnClickScript() method, return null and be declared final. What to you people think? -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]