Auto Selecting an answer in a second question

0

I have a survey where we ask a question “Tell us all the reasons that you purchased Brand A. Select all that apply” and have a listing of around 10 items with an other category with an open ended response box. This is of course a checkbox question.

We then ask a follow on question “Tell us the primary reason that you purchased Brand A” and only list the items from the first question that we selected. This is of course a radio button question.

What I am trying to do is in the rare circumstance that the respondent only selected one item in the question “Tell us all the reasons” then to auto select that in the follow up question.  I assume this is doable with a javascript action, but does anyone have any advice on how to structure or if there is a better workaround to get this accomplish?

Jon Erickson asked
    0

    Mary, thank you for the note about Get and Set actions, I don’t know why I did not think of going in that direction.  I also found an action called sgapiCheckboxTotalChecked that I can use to check the number of items selected in the first question and then if it is equal to 1 run through the various answers in the second question to Set the one item that was in the first question using spapiSetValue.

    Works perfectly so thank you for getting my head to think the proper way.

    Jon Erickson answered
      0

      Hi Jon,

      The easiest fix would be to flip the order of your two questions. First ask the radio button question then on the next page ask the check box.  To set the answer in the second question, use a merge code of question 1 in the “Default Answer:” under the “Layout Tab”.

      If you want to keep your order as is, you code do this with some custom scripting.  Do you or anyone on your team have some experience with coding?  You could do an If/then statement and a sgapiget/sgapiset.  Here is the scripting library:   https://script.surveygizmo.com/help 

      Best,

      Mary

       

       

       

      Mary Panos Loy answered
        ×

        Login

        Question stats

        • Active
        • Views682 times
        • Answers2 answers
        • Followers0 followers