Tapestry
  1. Tapestry
  2. TAPESTRY-1030

cant seem to get a component updated if the event listener is applied to a method that doesnt submit a form

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1
    • Fix Version/s: 4.1.1
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      windows xp, maven 2 and latest snapshot release, firefox/IE, tapestry 4.1, 2gb of ram, etc

      Description

      The event doesnt seem to actually trigger invocation of a callback method on the server unless a form is submitted

      <pre>

      <span jwcid="@Shell" title="Foo 0.1" ajaxEnabled="true" browserLogLevel="DEBUG">
      <body jwcid="@Body">
      <form jwcid="f@Form" action="">
      <div id="mLink" style="background-color: yellow; width:100px;">
      click me
      </div>

      <div style="border:1px solid black; height : 40px; width : 400px;" jwcid="refreshme@Any">
      <span jwcid="@If" condition="ognl:good">
      <span jwcid="@Insert" value="ognl: message"> the msg goes here </span>
      </span>
      </div>
      </form>
      </body>
      </span>

      </pre>
      and the class
      <pre>
      import org.apache.tapestry.IRequestCycle;
      import org.apache.tapestry.annotations.EventListener;
      import org.apache.tapestry.annotations.Persist;
      import org.apache.tapestry.event.BrowserEvent;
      import org.apache.tapestry.html.BasePage;

      import java.text.MessageFormat;

      abstract public class Playground extends BasePage {
      abstract public boolean isGood();
      abstract public void setGood(boolean good);

      @Persist abstract public String getMessage();
      abstract public void setMessage(String message);

      @EventListener(events = "onclick", submitForm = "f", elements = "mLink")
      public void updateThings(IRequestCycle c) {
      BrowserEvent event = new BrowserEvent(c);
      setGood(true);
      setMessage("base page " + new java.util.Date());
      System.out.println(MessageFormat.format("x =

      {0}

      , y=

      {1}

      ", event.getPageX(), event.getPageY()));
      getRequestCycle().getResponseBuilder().updateComponent("refreshme");
      }
      }

      </pre>

      work. When you click the square a listener on the server (namely, updateThings) is called, the variable message is changed and a call to responseBuilder.updateComponent is honored and the values on the page are changed.

      Remove the form from the html, and remove the submitForm part from the EventListener annotation and a different ituation arrives where, amazingly, tapestry seems to be getting a valid (if empty) ajax response and theres no indication (on the console or the page ) that the listener was invoked

        Activity

        Hide
        Jesse Kuhnert added a comment -

        I think this was resolved by the other fix.

        Show
        Jesse Kuhnert added a comment - I think this was resolved by the other fix.

          People

          • Assignee:
            Jesse Kuhnert
            Reporter:
            Joshua Long
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development