Problem with the script for a hidden value

Hi everyone, I'm trying to write a simple script for a Select module Option, but it doesn't seem to work and I don't know why.

Basically, if option A or B is not selected in SelectModule1, option C in SelectModule2 should remain hidden (hidden=true). If option A or B is selected in SelectModule1, option C in SelectModule2 should become visible (hidden=false).

I'm trying to write the script for the Hidden value for Option C in SelectModule2.
What I need is a basic NOR function. If A or B is selected, the Hidden value should become FALSE.

!({{SelectModule1.value != "A"}} || {{SelectModule1.value != "B"}})

My problem is that it doesn't seem to accept the NOT/! operator. For example, if I omit NOT/! and I select A it gives me the value (false || true)--> true, which is right, but if I put NOT/! in front of the script it still gives me true instead of false.

What am I doing wrong? Am I missing something?

Thank you in advance.

there was a typo, instead of
!({{SelectModule1.value != "A"}} || {{SelectModule1.value != "B"}})
I wrote
!({{SelectModule1.value != "A"}} || {{SelectModule2.value != "B"}})
sorry again

If I am reading your post correctly:
{{SelectModule1.value === 'A' || SelectModule2.value === 'B' ? true:false}}

If options A and B exist in SelectModule1 then your logic is checking if B is selected in Module2 not 1?
Should this:
!({{SelectModule1.value != "A"}} || {{SelectModule2.value != "B"}})
!({{SelectModule1.value != "A"}} || {{SelectModule1.value != "B"}})
Or more simply the "If A or B" code that Scott posted

Sorry, I found a typo in my question, I'm going to edit it now to clear things up

Yes, sorry I just noticed there was a typo in my question, I've edited it to make it right

I don't think it changes the logic you need
If A or B is chosen then the hidden value of C is False, otherwise True

{{ SelectModule1.value === 'A' || SelectModule1.value === 'B' ? false : true }}

I think your original logic maybe should have used is the AND operator instead of OR - so is it not A AND is it not B. Anyway, the positive assertion above ("Is it A or is it B") is easier to read and debug, I find. Give it a try, this kind of logic can be quite confusing.


Sorry for the late reply, but I can confirm this works perfectly
Thank you very much!

1 Like