JavaScript in Comment in survey | XM Community
Skip to main content
Question

JavaScript in Comment in survey

  • June 10, 2024
  • 4 replies
  • 51 views

Forum|alt.badge.img+2
  • Level 3 ●●●
  • 63 replies

Can someone help me with javascript?
I need to add code in a comment in survey
If question q1 had a score <=6 make this question mandatory, otherwise make optional.

4 replies

qualtrics_nerd
Level 5 ●●●●●
Forum|alt.badge.img+19
  • Level 5 ●●●●●
  • 227 replies
  • June 11, 2024

Hi @Aine ,

Could you please explain the requirements for how the score is being calculated? Also, could you confirm if the JavaScript applied is for the same question as q1?


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+34
  • Level 8 ●●●●●●●●
  • 654 replies
  • June 11, 2024

We can use custom validation for this →  Score in Q1 >= 7 OR this question is not empty.


Forum|alt.badge.img+2
  • Author
  • Level 3 ●●●
  • 63 replies
  • June 11, 2024

Hello @Shashi 

Ahhh you know that I made several tests with Custom Validation and none of them works, that's why I want to resort to Java script ...
Would you give me an example of how to write the code, 
if the question number 1 <= 6, that this question where I add the code is mandatory???

 

This is the link to how you helped me and the tests I did with custom validation:

Thanks


Forum|alt.badge.img+2
  • Author
  • Level 3 ●●●
  • 63 replies
  • June 11, 2024

Hello @Shashi 

I did a last test with what you proposed and it works correctly ... thank you very much