Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Verify that slider has been moved

This jQuery slider works very nice in v7, but I would like to verify that the slider is moved by the respondent. Does anybody have a solution for this problem?
related to an answer for: Sliders For Grids
asked Aug 13, 2014 by anonymous

1 Answer

0 votes
Best answer
This is more or less copied straight from the jQuery example slider : http://jqueryui.com/slider/#rangemin

One of the main things I changed is to remove the default value part of the JavaScript code and only left the listener on the slider, so if I do nothing, it will be blank.

So I'm left with the following code in a Free Format question named "slider" with variable name "slider_value":

  $(function () {
      range: "min",
      value: 37,
      min: 1,
      max: 700,
      slide: function (event, ui) {
        $("#amount").val("$" + ui.value);

  <label for="amount">Maximum price:</label>
  <input name="slider_value" type="text" id="amount" style="border:0; color:#f6931f; font-weight:bold;">
<div id="slider-range-min"></div>

Then in the Advanced Tab, add the custom validation to catch if the answer input field has a empty string since it will remain blank until the respondent has moved the slider.

  var strErrorMessage = "You must select a value.";

Hopefully that sparks something that will help you.
answered Aug 13, 2014 by Kenneth Fairchild Bronze Sawtooth Software, Inc. (3,820 points)
Thank you very much, Kenneth. Works perfectly even on touchscreens when touch punch ui is added. I capture the value in a numeric field so it's even not necessary to add the custom verification because I can set the numeric variable to required.