Make Multiple Buttons Disappear if Respective Data Fields are Empty

Hello all! I’m hoping someone can help with this, as I’ve been struggling with it on my own and have realized I just don’t know enough to know where I went off the rails here. I have a dynamic page that is fed data from a custom form on my site. It’s used to create exhibition pages for art galleries that they can submit themselves. It works quite well. However, my problem is this: the form allows galleries to submit up to ten artworks with artwork information, but some galleries choose to submit less. In this case, the “inquire” buttons that I’ve added to direct to a “mailto:” link still appear. I need them to disappear when the corresponding database field is empty.

I used this tutorial to write my code: https://support.wix.com/en/article/corvid-tutorial-hiding-a-video-player-when-there-is-no-video-to-play

When I used this code for a single button, it worked perfectly. But when I tried to update it to work for all ten buttons, it stopped working and the buttons are all just hidden. Can anyone look at my code and advise on where I’ve gone wrong?

$w.onReady(() => {
    $w("#dynamicDataset").onReady(() => {
 const item = $w("#dynamicDataset").getCurrentItem();
 if (!item.inqure1) {
            $w("#button16").collapse();
        }
 if (!item.inqure2) {
            $w("#button17").collapse();
        }
 if (!item.inqure3) {
            $w("#button18").collapse();
        }
 if (!item.inqure4) {
            $w("#button19").collapse();
        }
 if (!item.inqure5) {
            $w("#button20").collapse();
        }
 if (!item.inqure6) {
            $w("#button21").collapse();
        }
 if (!item.inqure7) {
            $w("#button22").collapse();
        }
 if (!item.inqure8) {
            $w("#button23").collapse();
        }
 if (!item.inqure9) {
            $w("#button24").collapse();
        }
 if (!item.inqure10) {
 // Collapses the video player if there is no value for "video"
            $w("#button25").collapse();
        }
    });
});

This is an example of one of the published pages: https://www.ifpdaviewingrooms.org/ifpda-viewing-room/valerie-hammond-|-at-the-edge-of-our-gardens

Your code looks fine, so the problem is somewhere else.
I couldn’t find these buttons on the link you added.
And anyway, you get the following error there:
Wix code SDK error: The link property that is passed to the link method cannot be set to the value “wifdfdfpress@gmail.com” as this is not a supported link type.
(I changed the email so the spammers won’t find it in the forum. but you should check it in your console).

That’s frustrating! Honestly I was really hoping I’d missed something in the code. I’m not familiar with that error, and can’t seem to find it in my console. I think it may be the main source of my problem, though. Do you think Wix may not be accepting the mailto: link as a url?

@alexedemasi Maybe you set one of the links to be the email address without “mailto:”

@jonatandor35 thank you for talking through this with me… knowing that the code looked right forced me to look for other problems, and it turns out I’d copied and pasted the same typo into all of my Field Keys when I wrote the code. Everywhere in the above code where you see “inqure”, it should have said “inquire”.