Overwrite #updateAjaxAttributes in your behavior or AjaxLink:

            @Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
            {
                super.updateAjaxAttributes(attributes);

                AjaxCallListener ajaxCallListener = new AjaxCallListener();
ajaxCallListener.onPrecondition("return confirm('are you sure'?);");
attributes.getAjaxCallListeners().add(ajaxCallListener);
            }

Sven


On 11/15/2012 06:14 PM, Nick Pratt wrote:
The examples for asking for user confirmation before destructive events
detailed here:
https://cwiki.apache.org/WICKET/getting-user-confirmation.html dont seem to
be applicable anymore (Wicket 6).

The JS examples listed result in an embedded onclick handler being attached
to the element, and the bound handlers (for an AjaxLink) are invoked
regardless of the return code of the embedded handler - so something like
this:

deleteUserLink.add( new JavascriptEventConfirmation( "onclick", "Are you
sure?" ) );

has no effect since the bound onClick handler of the AjaxLink seem to fire
regardless of the return value of the inline JS.

Whats the best way to achieve such confirmation in Wicket 6?

N



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to