Do you see why observe does not work? Or another method to make working what I want to do ? I'm stuck on this.
2014-09-22 16:39 GMT+02:00 squallmat . <squall...@gmail.com>: > Ok the javascript works now, but not the mixin itself. > I have a first select where i chose a value, and then a second select > where i chose another value. On change on the second select I ajax reload > both in a zone and i'd like the first to keep value. > > In the event method I reallocate the value of the first select, but still > it doesn't keep it even with this observer... am i missing something ? > > > 2014-09-22 16:27 GMT+02:00 squallmat . <squall...@gmail.com>: > > 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. >>>> >>> >>> >> >