ZF-6048: JQuery Slider reset to 0 with the default change event


When adding a JQuery slider form element, the slider will reset itself to 0 when the 'change' event is called. The fault line is

   $sliderUpdateFn .= sprintf('    %s("#%s").attr("value", %s("#%s-slider").slider("value", %d));'.PHP_EOL,

when the last %d is simply removed, the bug doesn't repeat itself and everyone is happy!

   $sliderUpdateFn .= sprintf('    %s("#%s").attr("value", %s("#%s-slider").slider("value"));'.PHP_EOL,

I actually don't know why that last %d is there as it is replaced by the handle index ($i) in the for... loop.

...or perhaps I am missing the point, but removing the last %d surely solve this problem.


An update ot the API, .slider("value", 0) sets the slider to 0 and return it (0). While .slider("value") simply returns the slider value.

Moreover, the line mentionned above may be replaced by this one

   $sliderUpdateFn .= sprintf('    %s("#%s").attr("value", ui.value);'.PHP_EOL,

which is clearer and cleaner.

I'll handle the issue as follows, in 1.8 the jQuery requirements will be raised to 1.3 and UI 1.7 for the CDN access. I'll fix this bug for 1.8 then and offer a backwards compability mode (somehow), by introducing a version value on the jQuery helper, which is used for comparisons of this kind.

Bug is fixed in trunk and merged back into 1.8 release branch.



to decide which javascript generation mode should be enabled for the request. The Slider then generates the correct Javascript depending on your library version.