Hi,
I have a free format question (Q21) with numeric text box and don't know checkbox for each attribute. I pipe in selected attributes from Q20 to Q21. The valid range for numeric text box is 0 to 100. I have written below validation script
var strErrorMessage="";
var Q20KValue='[%Q20_K%]';
if(Q20KValue>=1 && SSI_GetValue("Q21_ROW6L")=="" && SSI_GetValue("Q21_ROW6_1")==0)
{
strErrorMessage= "Response is required for 'Specialty' attribute."
}
else if (SSI_GetValue("Q21_ROW6L")!="" && SSI_GetValue("Q21_ROW6_1")==1)
{
strErrorMessage= "Please provide only one answer for 'Specialty' attribute."
}
var Q20IValue='[%Q20_I%]';
if(Q20IValue>=1 && SSI_GetValue("Q21_ROW5L")==="" && SSI_GetValue("Q21_ROW5_1")==0)
{
strErrorMessage= "Response is required for 'Automated' attribute."
}
else if (SSI_GetValue("Q21_ROW5L")!="" && SSI_GetValue("Q21_ROW5_1")==1)
{
strErrorMessage= "Please provide only one answer for 'Automated' attribute."
}
The problem is if I entered 0 in numeric textbox it throws 'Response is required' error and if I entered 0 and checked Don't know option then it doesn't throw 'Please provide only one answer' error.
But the script works fine for other values (1 to 100)