Show/Hide if field is empty

Hi,

I’m really stuck on how to show/hide an element on the app side if a dynamic value/field is empty.
For example, I want to show/hide a Paragraph (or the like) when the field is NULL - I highlight the paragraph and then use the Dynamic Attribute, and add Display >> Show or Hide and then using the light bolt icon, I select the Data format to create a condition.

But I can’t get this to work?
I’ve tried:

(mediaTitle != '')
(mediaTitle != NULL)

Can someone kindly assist please?

1 Like

You can just use the expression itself for this.

dmx-show="mediaTitle"

so this will evaluate to true, when mediaTitle returns a value.

Hi @Teodor, thanks for the reply,
I am trying to SHOW a paragraph if a dynamic field is NULL.

I tried ==‘’ and == NULL
but they are not working.

Well, then use

dmx-show="!mediaTitle"
1 Like

Thanks @Teodor, thanks it worked :slight_smile: . Can I ask, I am also trying HIDE an external image src/source if the URL is broken or returns no image.
So I have the image src as an external URL http://www.somesite.com/image.jpg, and if that URL does not contain the image.
Is there a way?

I found this to work if image source is broken/not found - not sure if there is a Wappler way.

onerror=“this.style.display=‘none’”