Have an idea?

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

Skip from Slider

Hi there,

I am using the Java Script below inside the footer of a Grid question to show a slider from -100% to 100%.  The skip logic of the following questions refers to this slider saying "skip if choosen %>=0". I saw that I can refer somehow to the value of the slider but I couldn't manage to get it work so far.

I was wondering if anyone has a solution for that?

I am using this Java:
        <link type="text/css" href="jquery/css/ui-lightness/jquery-ui-1.8.19.custom.css" rel="Stylesheet" />    
        <script type="text/javascript" src="jquery/js/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" src="jquery/js/jquery-ui-1.8.19.custom.min.js"></script>
                $( "#slider" ).slider(
                    range: "min",
                    value: 0,
                    min: -100,
                    max: 100,
                    slide: function(event, ui)
                          $( "#amount" ).val( "%" + ui.value );
                $( "#amount" ).val( "%" + $( "#slider" ).slider( "value" ) );
        <div class="demo">
                <label for="amount">Ausgaben:</label>
                <input type="text" id="amount" style="border:0; color:#f6931f; font-weight:bold;" />
            <div id="slider"></div>
        </div><!-- End demo -->

Thanks in advance!
asked Sep 16 by anonymous

1 Answer

0 votes
Hi user,

It seems that the slider that you have created is not capturing a value in a sawtooth variable.

Unable to understand why you have created a grid question, if it is for some other use. No problem.

Please create another grid question along with this grid question (say question name as "slide") with 1st row option as numeric value (min val=-100 and max val=100). Then hide this question by copying below css in header 1.

div#slide_div {
    display: none;

Also add below after line 18 in you code:

Now, use variable "slide_r1_c1" and apply any skip that you want.

I hope this helps.

Rahul Mittal
answered Sep 16 by Rahul Mittal Silver (9,060 points)