Have an idea?

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

Disable a radio button in Select Question

I  have a similar question but in a Select type with radio buttons:
  In my question "Cat1" I have "Other Specify" in the 7th list member.
  The next question is "Cat2" where I have listed 8 members:
     1 to 6 will be always shown
     7th is the one specified in Cat1 in Others as [% Cat1_7_other %]
     8th Other Specify

What I need is that if other is specified in Cat1, 7th shows that value and 8th is not shown. I tried using the next code in Text Editor of the 7th option but is not working:

<script type="text/javascript">
    var Otro = "[% Cat1_7_other %]";
    if (Otro == ""){
    } else {
related to an answer for: Always hiding and disabling radio buttons
asked Jun 9, 2022 by Mariela Ballinas

1 Answer

0 votes
For your question Cat2, instead of a predefined list just use a constructed list using Unverified Perl in the logic.  For this example, I will assume the name of the list is 'Cat2List' currently and that Cat1 and Cat2 are single response questions.  I am adding all 8 items of Cat2List.  Then adding item 7 if the answer at Cat1 was 7, otherwise adding item 8.  So the list will always have either item 7 or 8 but not both.  Hope this helps.

ADD (Cat2List)
Begin Unverified Perl
else {ADD("Cat2List",8);}
End Unverified
answered Jun 9, 2022 by Jay Rutherford Platinum (52,770 points)
It is not working, it always shows me Others. Not sure if this affects but Cat1 is Check box type, is it the same code?
Yes, that does make a difference, sorry I missed that.  I modifed the code below to only add the first 6 items always and then I modified the perl script for a checkbox type at Cat1.

ADD (Cat2List,1,6)
Begin Unverified Perl
else {ADD("Cat2List",8);}
End Unverified
Thanks a lot! It worked!!
Glad to hear that you got it sorted out as needed!