In my example the parameters are:
$p2.length
which has the value "0"
and the boolean
$suspectYesNo which is set to "false".
I would expect, that in my code the second #elseif will run due to my set parameters, but however it shows up that "Code 4 runs"
I guess, that my mistake is the connection of both conditions using "&&", but I have no clue how to correctly define the line with two conditions.
That brings me to the question: How to correctly combine the two conditions ($p2.length()==0) AND ($suspectYesNo.value.contains("true")) in one #elseif().
Or did I define the boolean wrong?
#if($p2.length()>0)
Code 1 runs
#elseif($p2.length()==0 && $suspectYesNo.value.contains("true"))
Code 2 runs
#elseif($p2.length()==0 && $suspectYesNo.value.contains("false"))
Code 3 runs
#else
Code 4 runs
#end
Thanks to user7294900 for providing me a reference with which I could solve the problem.
It did not read the boolean value as a string, which could be fixed by adding "toString()" method.
With this code here it works as desired:
#if($p2.length > 0)
Code 1 runs
#elseif($p2.length == 0 && $suspectYesNo.value.toString().contains("true"))
Code 2 runs
#elseif($p2.length == 0 && $suspectYesNo.value.toString().contains("false"))
Code 3 runs
#else
Code 4 runs
#end