[Solved] JS – check radio button in radio button list question



I want to check a radio button in radio button list question,

the code I wrote works great in regular page, but not in SG:

 radioListObj[i].checked = true;

can you pleqse help me write it the way it works?

Galit Appo176715 asked

    Best answer


    Hey Galit –

    Do you just need to use the first rank and use it in a following question? If so, I was able to do this via custom scripting rather than JS – So it would basically be pulling the ranks and putting them in a hidden value. It would look something like this:

    Q1) Rank the following:




    Q2 You said you like puppies(except puppies will be the merge code from your hidden value) the most, but why?

    Basically what you’ll be doing is pulling the array from the ranking grid, assigning it variables and then using those variables to populate hidden values for each rank. Here’s the script:

    %%ranks = sgapiGetValue(2);//Change ID to ID of Ranking Question

    %%output = sgapiPrint_R(%%ranks);

    %%first = %%ranks[”10001″];//You will use the above output to get these “10001” skus
    %%second = %%ranks[”10002″];//Change to second sku
    %%third = %%ranks[”10003″];//Third Sku
    %%fourth = %%ranks[”10004″];//Forth Sku

    sgapiSetValue(7,%%first); //Change to first hidden value
    sgapiSetValue(8,%%second); //Change to second hidden value
    sgapiSetValue(9,%%third); //Change to third hidden value
    sgapiSetValue(10,%%fourth);//Change to forth hidden value

    Let me know if that helps! -Lizzy

    Lizzy Tekkel answered

      Is there a need for doing this via JS?

      SurveyGizmo has a built-in feature that allows you to pre-select an answer:


      Dominic Sharpe answered


        Thanks for the answer.
        I use Ranking Grid, the ‘pre-select’ doesn’t support Ranking Grid.

        I want to save the Rank 1 selection, and to present it in next question.
        the way i found is to copy the question values to unvisible radioButtonList. this radioButtonList will be
        checked in JS when the user select Rank 1 answer in the Ranking grid, and will be present later using mergeCode.

        The problem is that the radioButton doesn’t checked
         although it works properly in JS.

        Any other ideas?

        Galit Appo176715 answered


          Question stats

          • Active
          • Views7158 times
          • Answers3 answers
          • Followers0 followers