disable editing in constant sum question with default choices | XM Community
Skip to main content
Solved

disable editing in constant sum question with default choices

  • November 16, 2023
  • 7 replies
  • 154 views

Forum|alt.badge.img+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

Best answer by Deepak

@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!

View original

7 replies

Forum|alt.badge.img+2
  • Author
  • Level 2 ●●
  • 27 replies
  • November 16, 2023

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


Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1549 replies
  • Answer
  • November 16, 2023

@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!


Forum|alt.badge.img+2
  • Author
  • Level 2 ●●
  • 27 replies
  • November 17, 2023

It Worked! Thank You soo much @Deepak 😊


Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1549 replies
  • November 17, 2023

@Bee 

Glad it worked kindly accept the answer.

Hope it helps!


Forum|alt.badge.img+1
Deepak wrote:

@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?


Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1549 replies
  • June 1, 2024

@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);}

});


Forum|alt.badge.img+1

@Deepak 

That worked!

Thank you. You are a genius and I greatly appreciate your assistance.


Leave a Reply