Free-Format Ranking - JavaScript Verification

Hello,

I had to create a free format in order to script the below question.

I added the below JavaScript verification but wanted to see there was a better way to write the script.

var a = SSI_GetValue("Q13_R1");

var b = SSI_GetValue("Q13_R2");

var c = SSI_GetValue("Q13_R3");

var d = SSI_GetValue("Q13_R4");

var e = SSI_GetValue("Q13_R5");

var x = SSI_GetValue("Q13_R1") + SSI_GetValue("Q13_R2") + SSI_GetValue("Q13_R3") + SSI_GetValue("Q13_R4") + SSI_GetValue("Q13_R5");

if (a == b || a == c || a == d || a == e || b == c || b == d || b == e || c == d || c == e || x!=15)

{

strErrorMessage = "The answers for this question each need to be unique.";

}

Thank you

1 reply