Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

SSI GetValue Error

can you help me with this validation

if in P16_1 it is = a 1 then in F17_r1_c1 and F17_r1_c2 they can not remain empty, at least there has to be an answer in one of them
  this is my syntax

if (SSI_GetValue("F16_1")==1 && (SSI_GetValue("F17_r1_c1") ==0 && SSI_GetValue ("F17_r1_c2") ==0) )

{strErrorMessage = "Tiene que mencionar al menos una marca para el producto Desmaquillador";}
   

else
{
bln_custom_result = true;
}
asked Nov 3, 2018 by JuanPablo687 (285 points)
Is it P16_1 or F16_1? Your question says that the variable is P16_1, but your logic calls it F16_1. Also, are these questions on the same page or different pages? If they're on different pages, then you'd need to use Perl to recall the P16_1 value, not JavaScript.
Sorry the question is F16_1 and it is a previous question and the F17_r1_c1 and F17_r2_c2 can not be empty if the F16_1 has been answered



please could you share the proper syntax for this validation I want to do
Should "bln_custom_result" be "strErrorMessage"? Looks like you have copied from an old Sawtooth Software version?
please could you share the proper syntax for this validation I want to do

I have version 8.4.6

1 Answer

0 votes
Hi Pablo,

The issue is that F16_1 is gathered on another page, so is not available to the JavaScript at runtime. You'd need to use SSI Script to recall that value instead. So, create a JavaScript variable and assign it to be equal to [% F16_1 %]. Then use the newly created JavaScript variable in your logic.

Best regards,
Aaron
answered Nov 3, 2018 by Aaron Hill Gold Sawtooth Software, Inc. (10,095 points)
please could you share the proper syntax for this validation that I want to perform
Try this:

if ([% F16_1 %] == 1 && (SSI_GetValue("F17_r1_c1") == 0 && SSI_GetValue("F17_r1_c2") == 0)) {
    strErrorMessage = "Tiene que mencionar al menos una marca para el producto Desmaquillador";
}
...