Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Issue with logical OR condition

Avatar

Level 1

We have a dropdown and whenever we change it the form gets submitted.
We are adding all the query parameters as hidden in the page. Also we dont want to add specific parameters. Below is the line which iterates through a list and adds them.

<input type="hidden" class="query-params" name="${item}"

               value="${request.parameterMap[item]}" data-sly-test="${item != 'string1' || item != 'string2'}" />

Now the problem is we have either string1 or string2 in the query parameters, but not both at the same time. Hence if we put string1 first in the condition the values of string2 are getting added multiple times and if we put string2 first then all the values of string1 are getting added as hidden. According to the definition if we the first condition fails it should check the second condition as well which is not happening.  How can we make it work?

0 Replies