Have an idea?

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

I'm trying to use sliders, but the max value for the slider is dependent on a list.

Here is the code that I've been working with. I've created a list named "Max" and those are all the max values for the sliders. However it is not pulling in any max values, in fact now the slider has just turned into a numeric question; with an empty box looking for a number to be typed in.

I've attached the code below, the line with "var max" is the line in question.

    // Parameters
    var gridOrientation = 'r'; // 'r' for row-oriented grid, 'c' for column-oriented grid
    var mobileOrientation = 'r'; // 'r' to make mobile grid's use horizontal sliders, 'c' to make mobile grid's use vertical sliders 
    var min = 0;
    var max = [% ListValue (Max,1) %];
    var step = 1;
    var rtl = false; // whether horizontal sliders should have the highest number on the left
    var ttb = false; // whether vertical sliders should have the highest number on the bottom
asked Jan 29 by Carly
A few thoughts:

First, do you mean to use ListLabel instead of ListValue?  ListValue returns the position of items in a list, rather than the actual text of a list.

Second, are you looking to give each slider a different max value?

Third, if the question shows up with numeric fields, something must be going wrong with the JavaScript.  Can you open your browser's console (F12 > "Console") when viewing this question and see if any red error messages appear?
Thank you for pointing out the ListLabel vs. ListValue differences. I have change it to ListLabel, but am still getting the same error.

There is a list of 13 possible max values (a few repeat), depending on which randomly selected offer is selected. So there may be one or 2 sliders with the same max, but primarily they'll all be different. However they will all be dependent upon the randomly selected list offer.
The Sliders question is not setup to support varying maximums at this time.

Your goal is that the maximum of the Nth row be the Nth list label from this list?
What if I were to use a constructed list to pull in the correct min and max? Could it work like that?
There's nothing that makes this impossible.  It just requires additional scripting to be done.  As is, the code expects "min" and "max" to be single numbers - setting them to lists of values isn't enough for the code to know you want it to do.

To be clear, your objective is to have two lists Min and Max whose labels control the minimum and maximum slider values, right?

Your solution to the original question

Please only use this to answer the original question. Otherwise please use comments.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

To avoid this verification in future, please log in or register.