ok I used bind function instead of observe. And even with the original
values $(spec.id) without the # the code works now.
First time i make a javascript working :p

2014-09-22 15:56 GMT+02:00 squallmat . <squall...@gmail.com>:

> Hi Lance, thanks for the help. Yes i really need to learn javascript, I
> still have an error on the js you gave me :
> apparently the observe() function is a prototype one, i'm trying to find
> an equivalent in jquery but i didn't found yet.
> Do you know how i could convert this observe() to jquery ?
>
> 2014-09-22 14:12 GMT+02:00 Lance Java <lance.j...@googlemail.com>:
>
>> Well, if you want to call yourself a web developer... it's probably about
>> time you learnt a bit of javascript ;)
>>
>> The jquery version would probably look something like:
>>
>> T5.extendInitializers({
>>    observe: function (spec) {
>>       $('#' + spec.id).on(spec.event, function() {
>>          var params = {};
>>          if (spec.fieldIds) {
>>             for (var i = 0; i < spec.fieldIds.length; ++i) {
>>                var fieldId = spec.fieldIds[i];
>>                var paramName = "observe" + i;
>>                var paramValue = $('#' + fieldId).val();
>>                params[paramName] = paramValue;
>>             }
>>          }
>>          var zoneManager = Tapestry.findZoneManagerForZone(spec.zone);
>>          zoneManager.updateFromURL(spec.url, params);
>>       });
>>    }
>> });
>>
>> Please note, it's untested and I'm not that familiar with tapestry-jquery.
>> I'm not even sure if Tapestry.findZoneManagerForZone(...) has been
>> implemented in tapestry-jquery.
>>
>
>

Reply via email to