cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Re: cforms: events on widget instances
Date Fri, 30 Apr 2004 12:30:14 GMT
Sylvain Wallez wrote:

> Bruno Dumon wrote:

...

>> And now the practical side: example usage in flowscript:
>>
>> form.getWidget("test").addActionListener(newActionListener(function(event) 
>> {
>>        print("hi there");
>> }));
>>
>> where the newActionListener function is as follows:
>>
>> function newActionListener(listenerFunction) {
>>    var listener = {actionPerformed: listenerFunction };
>>    var adapter = new
>> JavaAdapter(Packages.org.apache.cocoon.forms.event.ActionListener,
>> listener);
>>    return adapter;
>> }
>>
>> Question: do we add these newActionListener and newValueChangedListener
>> functions to the (javascript) form object, or as separate functions next
>> to it? 
>>
>
> It could also be an additional method of ScriptableWidget, which would 
> take care of the adaptation.


Agreed. And syntax should become then simply:

form.getWidget("test").addActionListener(function(event) {
       print("hi there");
});


Vadim


Mime
View raw message