Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-1046

EventListener invoke all listener inside a form eventhought only one event was trigger

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.1
    • 4.1.1
    • Annotations
    • None
    • OS: Sun Solaris
      Tapestry version: 4.1.1

    Description

      I had a html template as folow:

      <form jwcid="myForm@Form" listener="listener:listener1">
      <div jwcid="valueDiv@Any" id="valueDiv" >
      <span jwcid="@Insert" value="myValue1" />
      <span jwcid="@Insert" value="myValue2" />
      <div>

      <button type="button" jwcid="btn1@Any" id="btn1" value="Hit me1" />
      <button type="button" jwcid="btn2@Any" id="btn2" value="Hit me2" />
      </form>

      And I declared in java file as folow:

      public abstract void setMyValue1(String s);
      public abstract void setMyValue2(String s);

      @EventListener(events = "onclick", targets = "btn1", submitForm = "myForm")
      public void listener1(IRequestCycle cycle) {
      setMyValue1( Math.random() + "" );
      }

      @EventListener(events = "onclick", targets = "btn2", submitForm = "myForm")
      public void listener2(IRequestCycle cycle) {
      setMyValue2( Math.random() + "" );
      }

      public void listener(IRequestCycle cycle) {
      System.out.println("do nothing");
      }

      After page rendered, If I click on one of two buttons 'Hit me1' or 'Hitme2' then I saw that all of three listener method were called.
      I dont known exactly this is a bug or not, maybe I wrong some thing but I have never see this problem if I use Submit component. Please let me known.

      Attachments

        Activity

          People

            jkuhnert Jesse Kuhnert
            khoadinh dinh anh khoa
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment