I need custom validation to make sure the survey taker can only chose one option per statement | XM Community
Skip to main content
Solved

I need custom validation to make sure the survey taker can only chose one option per statement

  • June 1, 2023
  • 5 replies
  • 123 views

Forum|alt.badge.img+14

This is the setup that I was trying to create….I am using side by side question type and put a table in the statement part to get the two statement and or to show pretty close to the setup.  Now for the part where they can only check one option is the problem now.  Can someone help me with the validation code?  

I am using side by side question type to make sure that the survey will be accessible since the brand has the inaccessible questions turned off.

Best answer by Eumetis

We were trying to keep the look of the survey that she was using that is why we had it setup the way we did.

You can add the below code in javascript window. This was answered on this link
Qualtrics.SurveyEngine.addOnReady(function()
{
    /*Place your JavaScript here to run when the page is fully displayed*/

   /*Place your JavaScript here to run when the page loads*/
   jQuery("#"+this.questionId+" input[type=checkbox]").click(function() {
      if(this.checked) {
var cb = jQuery(this);
cb.closest("tr").find("[type=checkbox]").not(cb).prop("checked",false);
      }
   });

});

5 replies

Forum|alt.badge.img+11
  • QPN Level 5 ●●●●●
  • June 29, 2023

This is the setup that I was trying to create….I am using side by side question type and put a table in the statement part to get the two statement and or to show pretty close to the setup.  Now for the part where they can only check one option is the problem now.  Can someone help me with the validation code?  

I am using side by side question type to make sure that the survey will be accessible since the brand has the inaccessible questions turned off.

Hi Linda, 

Could you elaborate the question more, like what are two check boxes on each side and how are you setting it up in Qualtrics


Forum|alt.badge.img+14
  • Author
  • Level 3 ●●●
  • June 29, 2023

The boxes are on the left side is Very much like this Child and Sort of like this child

The boxes are on the right side is Sort of like this child and Very much like this child

I am using side by side question type somehow I do have the statements in the middle and the two boxes on each side.  To get the statements show right I am put them in a table diving the cell.

So for each line you can only pick one of the check box.

 


Forum|alt.badge.img+11
  • QPN Level 5 ●●●●●
  • June 29, 2023

The boxes are on the left side is Very much like this Child and Sort of like this child

The boxes are on the right side is Sort of like this child and Very much like this child

I am using side by side question type somehow I do have the statements in the middle and the two boxes on each side.  To get the statements show right I am put them in a table diving the cell.

So for each line you can only pick one of the check box.

 

I have setup the question like this and rather than having a check box if single answer option is selected the answer choices automatically become exclusive (only one of the 4 can be selected)


Forum|alt.badge.img+14
  • Author
  • Level 3 ●●●
  • June 29, 2023

We were trying to keep the look of the survey that she was using that is why we had it setup the way we did.


Forum|alt.badge.img+11
  • QPN Level 5 ●●●●●
  • Answer
  • June 29, 2023

We were trying to keep the look of the survey that she was using that is why we had it setup the way we did.

You can add the below code in javascript window. This was answered on this link
Qualtrics.SurveyEngine.addOnReady(function()
{
    /*Place your JavaScript here to run when the page is fully displayed*/

   /*Place your JavaScript here to run when the page loads*/
   jQuery("#"+this.questionId+" input[type=checkbox]").click(function() {
      if(this.checked) {
var cb = jQuery(this);
cb.closest("tr").find("[type=checkbox]").not(cb).prop("checked",false);
      }
   });

});