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

                 Key: TAPESTRY-1030
                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1030
             Project: Tapestry
          Issue Type: Bug
          Components: Framework
    Affects Versions: 4.1
         Environment: windows xp, maven 2 and latest snapshot release, 
firefox/IE, tapestry 4.1, 2gb of ram, etc
            Reporter: Joshua Long


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="[EMAIL PROTECTED]" action="">
<div id="mLink" style="background-color: yellow; width:100px;">
    click me 
</div>

    <div style="border:1px solid black; height : 40px; width : 400px;" 
jwcid="[EMAIL PROTECTED]">
          <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



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to