Have an idea?

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

Hide rows in select question based on loop

Hello again!  I have a select question (q301) in a loop and I'd like to hide a row in the question based on what loop they are in.  I found the code to remove the radio button but I'm hoping there's a way to just hide the whole option for that question.

I've played around with style.display but not sure if I'm calling the question up right, doesn't seem to work.

 if ([% LoopValue() %] == 13)
 document.getElementById("q301_1_graphical").visibility = 'hidden';
 document.getElementById("q301_1_graphical").disabled = 'true';
 document.getElementById("q301_1_graphical").className = 'HideElement';
 document.getElementById("q301_1").style.display = 'none';

Any help would be appreciated.  Thanks!
asked Nov 24, 2019 by Geoff Yeaton
Can you simply use a constructed list instead at q301?

Try to use a constructed list as follows ...
Begin Unverified Perl


 if (LOOPVALUE()==13)

End Unverified

This will add all codes from the parent list (I've called it q301List).

If the loop value is "13", then remove item 1.

Change the question names / list names in this script to your liking and test it out.

Let me know how it goes.
Perfect solution, I can't believe I didn't think of that!  Thank you Paul, much appreciated!

1 Answer

0 votes
Awesome, glad it worked Geoff.

Well done Sir.
answered Nov 24, 2019 by Paul Moon Platinum (97,470 points)