Hi all -
This is my first post; I have been enjoying learning jQuery, but have
now run into a brick wall.
I have a form that contains dynamically-generated sliders. My intent
is to display these sliders, have a user set them and, upon form
submission, save the values. On subsequent page views, I'd like to
have the slider display the previously-saved value. There can be many
of these sliders (currently there are about 168 on a given page(!)). I
have tried setting the startValue using the previously-stored value in
a JavaScript array, and I have also tried moving the sliders to the
appropriate position after they are generated using moveTo. Nothing
seems to work.
Here is the meat of my code - it is short enough that I think it is OK
to just display it inline here; indexToValueArray is just a JavaScript
array mapping indices to integer values 0-9 (i.e., the saved values of
the sliders):
for (i in indexToValueArray) {
var sliderValField = '#slider_val_' + i;
$(sliderValField).val(indexToValueArray[i]);
$('#slider_' + i).slider({
handle: '#slider_handle_' + i,
startValue: indexToValueArray[i],
minValue: 0,
maxValue: 10,
steps: 10,
slide: function(e, ui) {
$(sliderValField).val(Math.round(ui.value / numSliders));
}
});
}
Neither the setting of $(sliderValField) nor the startValue bound to "$
('#silder_' + i).slider" work properly.
I am fairly new to anything beyond fairly basic JavaScript. I am
wondering if I am running into some kind of scoping thing or if my
approach is just dumb.
Thanks a million for any insight!
- Tim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---