Have an idea?

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

Other specify in combo box

Hi,

My query is same as the below link contains but for drop down list.

https://sawtoothsoftware.com/forum/13610/other-respondent-specify-box-displayed-only-option-selected

I have 21 options under drop down menu, the other specify text box should appear only if the last option 'other' is selected. I have created free format question for combo box and other specify text box. I need to hide the text box and it should appear once option 'other' is selected. Please help me by editing the code available in the above link to work for free format question.

Variable name: Q4_A
Text box: Q4_OE

Please help me. Let me know in case of any questions.
asked Sep 6, 2018 by Abdul Bronze (2,630 points)

1 Answer

+1 vote
 
Best answer
Try adding this JS to your free format question:

<script>
$(document).ready(function(){
    $('#[% QuestionName() %]_A').change(function(){
        $('#[% QuestionName() %]_OE').toggle(SSI_GetValue('[% QuestionName() %]_A') == 21);
    });
    $('#[% QuestionName() %]_A').change();
})
</script>


Optional JS verification:

if (SSI_GetValue('[% QuestionName() %]_A') == 21 && !SSI_GetValue('[% QuestionName() %]_OE')) {
    strErrorMessage = 'Error message.';
}
answered Sep 6, 2018 by Zachary Platinum Sawtooth Software, Inc. (148,125 points)
selected Sep 6, 2018 by Abdul
It is perfect Zachary. Thanks you so much.
...