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