Board Logo

Can I lock the slider, i.e. use it for display only?
Martha - 6/15/2007 at 01:24 AM

We're using the slider as a "visual analogue scale", where we're not really interested in the value returned as a number, just as a position along the scale. This is easily done on the input side: we've connected the slider to a hidden input field, so the user only sees the slider, with no numbers in evidence whatsoever.

We'd like to display the results using the same slider, but we don't want the viewer to be able to move the knob. Is there some way to lock the slider, or set it to readonly, or something like that?


tigra - 6/15/2007 at 05:12 AM

Just kill all the events handling in the control by removing mouse events attributes from the HTML inside the slider (i.e. onmousemove, onmousedown etc)


Martha - 6/15/2007 at 02:12 PM

Thanks for the reply, but I'm afraid I need a bit more basic help than that. :/ Javascript really isn't my thing - mostly, I use vbscript. (I know, I know, heresy, but there you have it.)

I'm not referencing any mouse events in my HTML - there's nothing I can remove. Is this something I need to edit in slider.js? I was hoping I didn't need to do that, partly because Javascript really isn't my thing, and partly because I would prefer not to have two versions of the script.


tigra - 6/15/2007 at 02:53 PM

The script isn't designed for the behavior you require so the changes to slider.js are needed. You can find the HTML code inside that file (lines 35 & 36). If you also need responsive slider you'll end up with two versions. You can submit a customization request and we'll create special version for you that can be configured to not react to user actions.


Martha - 6/15/2007 at 03:23 PM

Line 35... lessee... aha, this must be it:
onmousedown="return f_sliderMouseDown(' + this.n_id + ')"

I removed that bit from the img tag, and now the sliders do (or rather, don't do) exactly what I want them to do (or not do). Thank you!

(I also had a bit of a headache figuring out why I was getting "cannot find the input with NAME=s3" errors - turns out it was because my viewer page didn't have a form around the input controls. Duh! Just 'cause they're hidden doesn't mean they don't need to be in a form. :)


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/