brad
March 24, 2020, 4:44pm
1
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>
Teodor
March 24, 2020, 4:45pm
2
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?
brad
March 24, 2020, 4:48pm
3
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.
Teodor
March 24, 2020, 4:49pm
4
It's not 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
brad
March 24, 2020, 4:51pm
5
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.
2 Likes
Marzio
July 4, 2023, 10:30pm
6
Teodor:
&&
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?
Marzio
July 4, 2023, 11:01pm
8
OK thank you
I had thought of this too but I thought it didn’t work in all combinations. Instead it works