Hide element based on two values

I have a simple paragraph that I need to hide if two fields have values. Doing with one field is very straight forward but I can’t seem to get the syntax right for two values. Below is my code.

<p class="small text-secondary text-center" dmx-hide="clientdetails.data.query1[0].client_email && clientdetails.data.query1[0].client_key">Client must have an Email Address and Secure Key to access the Client Gateway.</p>

Hello Brad,

The current condition used here:

dmx-hide="clientdetails.data.query1[0].client_email && clientdetails.data.query1[0].client_key"

will hide the element when both client email and client key return values. What is the condition you want to add there?

Hmmm, how is yours different than mine? They look the same to me but it doesn’t work. As far as I can see you have exactly the same as I have.

You are correct that I am trying to hide if the two fields have a value.

It’s not :slight_smile: i just copied yours.
So what’s not working - are you sure both return value, and is the element not hidden?

Can you add this on your page, and see what does it return:

{{clientdetails.data.query1[0].client_email && clientdetails.data.query1[0].client_key}}

?

1 Like

Doh! Found the problem. I had no space between && and one of the values. Good to know I did have the right syntax though.

Thanks for confirming that and I need more coffee. :coffee:

2 Likes

This code, if I’m not mistaken, with &&s hides or shows if both conditions are verified
But if I want at least one of the two conditions to occur?

try || instead of &&

OK thank you
I had thought of this too but I thought it didn’t work in all combinations. Instead it works