Script: Simple Grid - Horizontal Radio - Mutually Exclusive Column(s)

This article will show you how to setup a Horizontal Row Simple Grid so you have a mutually exclusive column


You may need to have a Horizontal Radio Simple Grid setup but you have a column that should only be used once. This article will show you how to do so using some Javascript instead of using a Custom Validation.  


  1. Program your 'Simple Grid - Horizontal Radio' question
    1. See article: Standard Question: Grid
  2. Add the following to the '+ Javascript' field
    1. See article: Adding JavaScript and/or CSS to a Question
    2. Copy and paste this into the '</> Add Javascript' field for your question.
      //console.log('radio change');
      var jElem = jQuery(evt.currentTarget);
      var checked = jElem.prop('checked');
      var column = jElem.prop('id').split('_')[2];
      var row = jElem.prop('id').split('_')[1];
      var isFirst = column == 8 ? true : false; /* UPDATE YOUR UNIQUE COL NUMBER VALUE HERE (8) */
      if (checked && isFirst)
      for (var i=1;i<=9;i++){   /* UPDATE YOUR MAX RESPONSE VALUE HERE (9) */
         if (i!= row){
            jQuery('#Q1_'+i+'_8').prop('checked',false);  /* UPDATE YOUR QUESTION NUMBER + UPDATE UNIQUE COL # (8)*/
    3. You will need to update the following in the code above:
      • The max response value. This is currently the number 9 in the code above but you would have to adjust this for your specific example. 
      • Your question number. This is currently "Q1" in the code above but you would have to adjust this to match your exercise. 
      • The unique column number. This is the number 8 in the code above and appears twice. 
  3. Make sure to test
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us