[Solved] How to implement a radio button/checkbox Shortcut that selects the same response for all rows in a grid question

0

Thanks in advance for any assistance. This board has been very helpful and responsive in the past.

Situation

  • Custom question made up of 6 tables of radio button grids
  • Each of the 6 tables has between 4 to 10 rows
  • For some of the 6 tables, respondents will frequently want to select the same response (i.e. column) for all rows in the table

Objective

  • Since the question is long, i’d like to make it as easy as possible for respondents to answer quickly)
  • To achieve this, for 4 of the 6 tables, I’d like to offer a radio button above the column headings, that if clicked, will select that column for all rows in the grid question (to act as a short cut)
  • I realise this isn’t good survey design but I’m trying to be a little pragmatic

I suspect the solution is a javascript solution and I’m not sure where to start. Any assistance would be greatly appreciated.

Joe Colgan372605 asked

    Best answer

    1

    Thanks for the question, this is a good one! Javascript is definitely the way to go. I wrote up a little example; check this out to see how it will work: http://www.surveygizmo.com/s3/2536054/test

    You’ll see that there’s an extra checkbox at the top of each column, and you can click there to select/unselect an entire column. Is that what you’re looking for?

    Here’s the script I used to accomplish this:

    //Caitlin wrote this 01.12.16

    $(document).ready(function(){
    $(‘.table1 tr:eq(0) th:eq(0)’).html(‘Select all in column’);
    $(“.table1 input[type=’checkbox’]”).change(function(){
    var col = $(this).attr(“title”);
    if($(this).is(“:checked”)) {
    $(“.table1 .sg-input-radio[title*=” + col + “]”).prop(“checked”,true);
    }
    else {
    $(“.table1 .sg-input-radio[title*=” + col + “]”).prop(“checked”,false);
    }
    });
    });

     

    You’ll only need to change a couple of things to make it work in your survey. I added the CSS hook table1 (under the Layout tab of the question) to the table I wanted to apply this to. Then, each of my column headers got a checkbox manually added to it. Where you would usually put your column title, I added in a bit of HTML, like this: <b>Not at all (1)</b><br />
    <input title=”1″ type=”checkbox” />

    We’re adding a checkbox with the title “1” there. I also added that to the rest of my column headers and just incremented the numbers to match the numbers in my column headers.

    That should help get you started! If you want me to add a copy of that testing survey to your account so you can play around with it, just let me know.

    Thanks!

    –Caitlin

    Caitlin - SurveyGizmo answered
      0

      hi again Caitlin. Would be great if you could include a copy of the testing survey to my account if that’s not too much trouble?

      many thanks.

      JC

      Joe Colgan372605 answered
        • I got that added to your account for you! Let me know if you need anything else. Just a heads up, too – I removed your phone number from the post, since this is a public board :)

        0

        This is exactly what I want. I’ve managed to implement this effectively. thanks for your great response.

        Joe Colgan372605 answered
          ×

          Login

          Question stats

          • Active
          • Views2181 times
          • Answers3 answers
          • Followers0 followers