Buy me a coffee :)

Wicket - jQuery UI

jQuery UI integration in Wicket 6.x, Wicket 7.x , Wicket 8.x & Wicket 9.x

Confirm AjaxButton

Components / Samples


Provides an AjaxButton which pop-ups an OK-Cancel confirmation dialog when clicked. In case of confirmation, the form is sent via an ajax post.

Note: this component is not an AjaxButton itself but a Panel, it should not be attached to a <button />; it can be attached on a <div /> or a <span /> for instance.

Warning: it is not possible to get a form component value - that is going to be changed - to be displayed in the dialog box message. The reason is that in order to get a form component (updated) model object, the form component should be validated. The dialog does not proceed to a (whole) form validation while being opened, because the form validation will occur when the user will confirm (by clicking on OK button). This the intended behavior.


package com.googlecode.wicket.jquery.ui.samples.jqueryui.button;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.RequiredTextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.Model;

import com.googlecode.wicket.jquery.ui.form.button.ConfirmAjaxButton;
import com.googlecode.wicket.jquery.ui.panel.JQueryFeedbackPanel;

public class ConfirmAjaxButtonPage extends AbstractButtonPage
	private static final long serialVersionUID = 1L;

	public ConfirmAjaxButtonPage()
		final Form<Void> form = new Form<Void>("form") {

			private static final long serialVersionUID = 1L;

			protected void onSubmit()
				info("Form submitted");


		// FeedbackPanel //
		final FeedbackPanel feedback = new JQueryFeedbackPanel("feedback");

		// TextField //
		final RequiredTextField<String> textField = new RequiredTextField<String>("text", new Model<String>());

		// Buttons //
		form.add(new ConfirmAjaxButton("button", "Submit", "Please confirm", "Do you confirm the new value?") {

			private static final long serialVersionUID = 1L;

			protected void onError(AjaxRequestTarget target)
				this.error("Validation failed!");

			protected void onSubmit(AjaxRequestTarget target)
			{"Model object: " + textField.getModelObject());
<!DOCTYPE html>
<html xmlns:wicket="">
	<title>Wicket jQuery UI: confirm ajax button</title>
	<div id="demo-panel">
		<form wicket:id="form">
			<input type="text" wicket:id="text" />
			<span wicket:id="button"></span><br />
			<div wicket:id="feedback" style="width: 360px;"></div>