Details
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 =
, 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