Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2438

AjaxEventBehavior not working on feedback message components



    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4.0, 1.4.1
    • 1.4.2, 1.5-M1
    • wicket
    • None
    • N/A


      If you add an onclick AjaxEventBehavior to a component that is used to display a message in a FeedbackPanel, then when you click the feedback message Wicket throws an exception. The exception looks like the following:

      WicketMessage: org.apache.wicket.WicketRuntimeException: component feedback:feedbackul:messages:0:message not found on page bug.HomePage[id = 0], listener interface = [RequestListenerInterface name=IBehaviorListener, method=public abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()]

      The problem seems to be caused by the change made in revision 796389, which removes all the child elements of the feedback panel when it is detached.

      The bug can be reproduced by creating a wicket-1.4.1 quickstart app and modifying HomePage.html to be:

      <html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" >
      <title>Wicket Quickstart Archetype Homepage</title>
      <form wicket:id="form">
      <input wicket:id="field" type="text" />
      <input type="submit" />
      <div wicket:id="feedback" />

      and HomePage.java to be:

      package bug;

      import org.apache.wicket.PageParameters;
      import org.apache.wicket.markup.html.basic.Label;
      import org.apache.wicket.markup.html.WebPage;
      import org.apache.wicket.markup.html.form.*;
      import org.apache.wicket.model.*;
      import org.apache.wicket.*;
      import org.apache.wicket.markup.html.panel.*;
      import org.apache.wicket.feedback.*;
      import org.apache.wicket.ajax.*;


      • Homepage
        public class HomePage extends WebPage {
        private Double value;

      public HomePage(final PageParameters parameters) {
      Form form = new Form("form", new CompoundPropertyModel(this));
      form.add(new TextField<Double>("field", Double.class));
      add(new FeedbackPanel("feedback") {
      protected Component newMessageDisplayComponent(String id, FeedbackMessage message) {
      Label label;
      label = new Label(id, "click me");
      label.add(new AjaxEventBehavior("onclick") {
      protected void onEvent(AjaxRequestTarget target)

      { System.out.println("error message clicked"); }

      return label;

      public void setField(Double field)

      { value = field; }

      public Double getField()

      { return value; }


      Launch the app and enter an invalid number (e.g. "xxx"). Submit the form and then click the "click me" message.




            ivaynberg Igor Vaynberg
            iml Ian MacLarty
            0 Vote for this issue
            0 Start watching this issue