You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alexey Hanin <ga...@gmail.com> on 2008/09/27 19:25:17 UTC

[T5] Passing page state with AJAX request

Hello,
Recently I started to examine AJAX features in T5 and I already have a lot
of question of course, but I'd like to go through the each very deeply.

The question is: how can I send an AJAX request from within the control and
also include component (page) state? I've created a mixin similar to T5
component's OnEvent, which adds listener that performs AJAX request upon
event and by receiving it Tapestry dispatches control to corresponding
method of the component.

Page.tml

<t:form>
    <input t:type="TextField" t:id="username"/>
    <input t:type="PasswordField" t:id="password"/>
    <div id="controls">
        <button t:type="any" t:id="submitButton" t:mixins="onEvent"
t:event="click" style="border: 1px solid #000">Send AJAX request</button>
    </div>
</t:form>

So far I'm able to handle AJAX event inside page class using @OnEvent(value
= 'click', component='submitButton') annotation, but I'd like 'username' and
'password' components binded to page class properties also be updated just
like when using old good form submit with t:submit. How can this be
achieved? I tried to serialize form data and pass with request in number of
ways (i.e. as post parameters), but no luck.