Have an idea?

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

Wondering how to use SSI_SetSelect() to pre-select a level for an attribute in an ACBC BYO question

I have seen postings that describe how to pre-select a radio button in either a select or grid question, but I can't get it to work in the BYO question of an ACBC excerise. I am trying to pre-select a specific level for an attribute in a BYO question.
asked Jul 23 by mconradSawtoothForum (275 points)
edited Jul 23 by mconradSawtoothForum
This is an example from a previous posting. This example would work for a select question, but how would I reference a radio button in a BYO question?
<script type="text/javascript">
SSI_SetSelect ("Q5_2",true); 
</script>

2 Answers

0 votes
I answered my own question, by running the survey in test mode and inspecting the HTML to find the correct name of the radio button I want to pre-select.

So let's say I have an ACBC BYO question called 'ACBCtesting_BYO' with three attributes and I want to pre-select the attribute in the 2nd row, and the value for the level I want selected is 8.  I reference that radiobutton and select it with the following:

<script type="text/javascript">
       SSI_SetSelect("ACBCtesting_BYO_2_8", true);
</script>
answered Jul 23 by mconradSawtoothForum (275 points)
0 votes
Radio buttons in BYOs are named "[EXERCISE]_BYO_[#]_[#]."  Here's your script altered for a BYO:

<script>
SSI_SetSelect('[% QuestionName() %]_1_1', true);
</script>


That will reset the question's response if a respondent submits the BYO then backs up to it.  If you want to avoid that behavior, you'll want to use a script like this:

<script>
if (!SSI_GetValue('[% QuestionName() %]_1')) {
    SSI_SetSelect('[% QuestionName() %]_1_1', true);
}
</script>
answered Jul 23 by Zachary Platinum Sawtooth Software, Inc. (129,150 points)
Thanks for the additional information about how to handle respondents backing up to the question.  Good stuff!
...