Remove pre-filled zero from constant sum (WITH BARS) | XM Community
Solved

Remove pre-filled zero from constant sum (WITH BARS)

  • 2 August 2021
  • 2 replies
  • 62 views

I have a question regarding the correct java code for removing pre-filled zeros from a constant sum question. While I am aware of how to do this for a constant sum question with choices only (https://community.qualtrics.com/XMcommunity/discussion/2531/constant-sum-without-prefilled-0), the code does not seem to work for constant sum questions with bars.
I appreciate your help!

icon

Best answer by JeremyK 27 August 2021, 19:18

View original

2 replies

Userlevel 5
Badge +7

Hey DW2020, don't know if you solved your problem or not, but I can shed some light on it for you. In a Constant Sum: Choices question, the elements are in a list (li). In Constant Sum: Bars, the elements are built out in a table (td). Changing your code to
jQuery("#"+this.questionId+" td input[type=text]").val("");
will change the value of the zeros when the type is set to bars. I'm struggling to get this to work because the JS is firing twice, once for the desktop view and then a second time for the mobile view. The first time through, all zeros are wiped out and it all looks good. The second time through, the zeros are added back in (thanks mobile) and I'm not sure how to suppress that. Still working on it, but the above code will have you grabbing and changing the correct elements at least.

Thanks JeremyK for your answer! That's a very helpful first step. If you find a solution to the issue you mentioned, I would be very happy to hear how you solved it.

Leave a Reply