disable editing in constant sum question with default choices | XM Community
Solved

disable editing in constant sum question with default choices

  • 16 November 2023
  • 6 replies
  • 105 views

Userlevel 1
Badge +2
  • Level 2 ●●
  • 27 replies

My form is a survey here respondents will enter scores in text entry box. At the end of the questions, they will see a summary of the scores they entered in the constant sum display. So i created the constant sum question ( Question type: Constant Sum, Answer type: Choices) question and inserted the score entries from the text boxes using default choices. 

Now i want to disable the text boxes in the constant sum such that if they want to make changes to their scores they will have to go back to the text entry where they entered the score instead of editing the score in the constant sum box. 

 

I hope this clarifies things

icon

Best answer by Deepak 16 November 2023, 18:12

View original

6 replies

Userlevel 1
Badge +2

@Deepak i created a new post for it. Can you assist me here please?

Userlevel 7
Badge +36

@Bee 

Try below code:

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var n= jQuery("#"+this.questionId+" .InputText").length; for (let i=0;i<n;i++)

{jQuery("#"+this.questionId+" .InputText").eq(i).prop('disabled',true);}
});

Hope it helps!

Userlevel 1
Badge +2

It Worked! Thank You soo much @Deepak 😊

Userlevel 7
Badge +36

@Bee 

Glad it worked kindly accept the answer.

Hope it helps!

Badge +1

@Bee

Try below code:

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var n= jQuery("#"+this.questionId+" .InputText").length; for (let i=0;i<n;i++)

{jQuery("#"+this.questionId+" .InputText").eq(i).prop('disabled',true);}
});

Hope it helps!

@Deepak this disabled editing of all the three statements in the question. I have a constant sum question where I have a piped in choice for the first option but need the participant to be able to add amounts statements 2 and 3. So, ONLY the number piped in from the previous question should be disabled from editing while the other two are open for entry. How do I edit the script to do that?

Userlevel 7
Badge +36

@Rajiv Vaidyanathan 

In place of n replace it with 1 in code and try. Something like

Qualtrics.SurveyEngine.addOnload(function()

{

 /*Place your JavaScript here to run when the page loads*/

var n= jQuery("#"+this.questionId+" .InputText").length; for (let i=0;i<1;i++)

 

{jQuery("#"+this.questionId+" .InputText").eq(i).prop('disabled',true);}

});

Leave a Reply