(bash|sh|shell|cpp|c|c\+\+|c#|c\-sharp|csharp|css|delphi|pascal|diff|patch|groovy|java|js|jscript|javascript|perl|pl|php||plain|text|py|python|rb|ruby|rails|ror|scala|sql|vb|vbnet|vb\.net|xml|html|xhtml|xslt) Slider partnered with NotApplicable option - strange behaviour when more than one slider - Sawtooth Software Forum

Have an idea?

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

Slider partnered with NotApplicable option - strange behaviour when more than one slider

Hi guys

I can't figure out what I'm doing wrong and it's doing my head in.  Have sent in a support request as well but posting here just in case someone has come across this in the past.

I have three slider questions, one after the other on separate pages, with the community NotApplicable thing going on.

Whatever you pick in the first select question follows through to the first slider question.  The first slider question seems to be working fine.  BUT the subsequent slider questions appear to be affected by that select question too which makes no sense.  If the first item in the select question is not picked, the N/A option does not appear from the second slider onward.  If the first code IS picked, the N/A option does come up but the question still doesn't work.  It appears to be having an issue with this piece of code in the javascript validation of the N/A part:


   // Open end, numeric else if (GLOBAL_SAWTOOTH_[% QuestionName() %].constantSumOrRanking.indexOf(item) == -1) { for (var c = 0; c < cols.length && !err; c++) { err = !$('#' + question + '_r' + item + '_c' + cols[c]).val().length; } }


Cannot read property 'length'of undefined

Anyone out there come across this behaviour before?
asked Jul 31, 2018 by Marion Silver (5,240 points)

1 Answer

0 votes
Upon inspecting your .ssi, it seems all of your Not Applicable questions are using the same list.  Be sure to update each N/A question to use the same list as their related grid question.
answered Jul 31, 2018 by Zachary Platinum Sawtooth Software, Inc. (202,850 points)
Of course!  Why didn't I see that!  Thanks, Zach.
So ... one further thing ... how would I put titles on this?  Say, instead of "Drag your slider to answer" I had something like "Satisfied" aligned left and "not satisfied" aligned right, all in line with the Don't Know?
You want a header row labeling the left end of the slider, the right end of the slider, and the checkboxes?
Yes,  that's right.
First, find and remove this from the sliders question:

    // Hide first row / first column
    if (gridOrientation == 'r') {
        $('#[% QuestionName() %]_div .inner_table > tbody > tr:first-child > td').hide();

    else {
        $('#[% QuestionName() %]_div .inner_table > tbody > tr > td:first-child').hide();

Then add this CSS and JS to the sliders question:

#[% QuestionName() %]_div .inner_table > tbody > tr:first-child > td:nth-child(2) > div {
    display: inline-block;
    width: 49%;

#[% QuestionName() %]_div .inner_table > tbody > tr:first-child > td:nth-child(2) > div:first-child {
    text-align: left;

#[% QuestionName() %]_div .inner_table > tbody > tr:first-child > td:nth-child(2) > div:last-child {
    text-align: right;

    var td = $('#[% QuestionName() %]_div .inner_table > tbody > tr:first-child > td:nth-child(2)');
    $(td).children(':first-child').text('LEFT LABEL');
    $(td).children(':last-child').text('RIGHT LABEL');
You rock, Zach!  Thanks a heap.