Adding Multiple Slider Controls to a Block Form

Permalink
I am working on an add-on, and I need to have multiple jquery slider control inputs on the same block form.

I've added multiple of these to the form, and they work - to a degree. So far, the data stores fine, but the problem is that when I go to change a value on one of the sliders, it also shows up on the others.

I learned how to add one through a how-to (see link below), but it didn't explain how to make it so I can have multiple of them on the same form.

http://www.concrete5.org/documentation/how-tos/developers/add-a-sli...

From this, how do I make it so that I can have more than one of these on the same form, without them interfering with each other?

PineCreativeLabs
 
tomicio replied on at Permalink Reply
tomicio
Feels like a problem of IDs on your sliders. In the demo, the slider is called with:
.$('div.my_percentage_slider') [...]


"div.my_percentage_slider" means all the divs that have the "my_percentage_slider" class assigned to it...

You should have more something with a direct call to the ID of your slider
.$('#id-of-slider1') [...]


Same thing applies to the other Jquery calls:
$('span.my_percentage_slider').text(uiobj.value+'%');
$('input.my_percentage_slider').val(uiobj.value);


You need to make sure they target a specific slider, not all of them.

Cheers!