You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Patrick Klein <pa...@bi-so.de> on 2007/07/16 21:44:20 UTC

T4.1.2, Ajax and EventListeners

Hello,

i got the following stituation at hand for which i search for a workable
solution.

The construct in the html-template looks like the following:

<div jwcid="@Any" id="ognl:wrapper1">
    <table>
       <div jwcid="rowcomponent_1"/>
       [...]
       <div jwcid="rowcomponent_n"/>
    </table>
</div>
<div jwcid="@Any" id="ognl:wrapper2">
    <table>
       [...]
    </table>
</div>

Each of the row components generates it's unique set of ids for it's
subcomponents like PropertySelections, TextFields or Checkboxes.

In the Java class there are EventListeners for each of the wrapper ids.
I want to catch the occurances of the change event of the
PropertySelections and Checkboxes but doing it directly does not work
with IE. My idea now would be to "hijack" another event which i am
allowed to catch at the div event with IE or maybe create a custom event
which i fire and catch.
Could someone please provide me with an example for the latter which i
think is the better way? (I have to commit i'm not the javascript geek
yet so i'm right now a bit lost here...)
The best would be only using functionality already provided by tapestry
and dojo.

Regards,
    Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T4.1.2, Ajax and EventListeners

Posted by Patrick Klein <pa...@bi-so.de>.
Hello, again,

i found a workable solution for the problem below. I simply make sure
some active element is present for each element i use a listener for.
Not elegant but it works.

Now i stumbled over another oddity/problem:

My eventlisteners look very much like

@EventListener(elements={DOM-IDs}, submitForm="myForm", events="onchange")
public void listener(BrowserEvent event) {
[...]
}

problem now is that regardless of other things i do everytime the
complete form gets refreshed in the ajax response (including the
javascript and hiddenfields part). Furthermore the listener itself never
gets called (the log output i have there is not shown in the logfile).
If i remove the submitForm statement the listener gets called but the
values stored in the input fields don't make it into the beans.
If i exchange elements with targets (i define all ids uniquely myself
which also defines the clientId,  i could confirm the identity using
getComponent("someId").getClientId()) nothing happens. A look into the
sourcecode of the generated page confirms that there is no event
listener for the given target-ids in the javascript part.

Had anyone here a similar experience and could help me out here?

Regards,
    Patrick
> Hello,
>
> i got the following stituation at hand for which i search for a workable
> solution.
>
> The construct in the html-template looks like the following:
>
> <div jwcid="@Any" id="ognl:wrapper1">
>     <table>
>        <div jwcid="rowcomponent_1"/>
>        [...]
>        <div jwcid="rowcomponent_n"/>
>     </table>
> </div>
> <div jwcid="@Any" id="ognl:wrapper2">
>     <table>
>        [...]
>     </table>
> </div>
>
> Each of the row components generates it's unique set of ids for it's
> subcomponents like PropertySelections, TextFields or Checkboxes.
>
> In the Java class there are EventListeners for each of the wrapper ids.
> I want to catch the occurances of the change event of the
> PropertySelections and Checkboxes but doing it directly does not work
> with IE. My idea now would be to "hijack" another event which i am
> allowed to catch at the div event with IE or maybe create a custom event
> which i fire and catch.
> Could someone please provide me with an example for the latter which i
> think is the better way? (I have to commit i'm not the javascript geek
> yet so i'm right now a bit lost here...)
> The best would be only using functionality already provided by tapestry
> and dojo.
>
> Regards,
>     Patrick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T4.1.2, Ajax and EventListeners

Posted by Jesse Kuhnert <jk...@gmail.com>.
IE doesn't fire onchange events reliably for checkboxes/radios.  You usually
have to add in onclick for those types specifically.

On 7/16/07, Patrick Klein <pa...@bi-so.de> wrote:
>
> Hello,
>
> i got the following stituation at hand for which i search for a workable
> solution.
>
> The construct in the html-template looks like the following:
>
> <div jwcid="@Any" id="ognl:wrapper1">
>     <table>
>        <div jwcid="rowcomponent_1"/>
>        [...]
>        <div jwcid="rowcomponent_n"/>
>     </table>
> </div>
> <div jwcid="@Any" id="ognl:wrapper2">
>     <table>
>        [...]
>     </table>
> </div>
>
> Each of the row components generates it's unique set of ids for it's
> subcomponents like PropertySelections, TextFields or Checkboxes.
>
> In the Java class there are EventListeners for each of the wrapper ids.
> I want to catch the occurances of the change event of the
> PropertySelections and Checkboxes but doing it directly does not work
> with IE. My idea now would be to "hijack" another event which i am
> allowed to catch at the div event with IE or maybe create a custom event
> which i fire and catch.
> Could someone please provide me with an example for the latter which i
> think is the better way? (I have to commit i'm not the javascript geek
> yet so i'm right now a bit lost here...)
> The best would be only using functionality already provided by tapestry
> and dojo.
>
> Regards,
>     Patrick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com