I want to add a warning dialog when user clicks an ajax "deleteLink"
I saw the following solution:
Link<Void> deleteLink = new AjaxFallbackLink<Void>("deleteLink")
{
@Override
public void onClick(AjaxRequestTarget target)
{
commentService.deleteComment(user, comment, ip);
setResponsePage(CommentsPage.class , pps);
}
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
super.updateAjaxAttributes(attributes);
AjaxCallListener ajaxCallListener = new AjaxCallListener();
ajaxCallListener.onPrecondition("return confirm('Are you sure?');");
attributes.getAjaxCallListeners().add(ajaxCallListener);
}
};
add(deleteLink);
It did popup a warning box , display "Are you sure?"
But no matter user clicks OK or Cancel
The comment get deleted !
What's wrong here ?
Thanks.
(wicket 6.7)