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

Reply via email to