Hello @sharond-wix coudl you pleaes help me with my code.
all the versions i have tried are not working. I need to do two things, hide an image if it isn’t present in the field cell and hide a button if there is no url connected to it.
Here is what i have so far for the image hiding.
It just seems to hide the image on the page no matter if the field is empty or not.
$w.onReady(() => {
$w(“#dynamicDataset”).onReady(() => {
const item = $w(“#dynamicDataset”).getCurrentItem();
if (!item.promo2) {
$w(“#placehold2”).collapse();
}
});
});
Here is the code i’ve tried for hiding the button, to no avail. I tried with my #dynamicDataset and with just a smaller #menudataset that references the #dynamicDataset neither work.
$w.onReady( function () {
$w(‘#dynamicDataset’).onReady( () => {
let url= $w(‘#dynamicDataset’).getCurrentItem().cafeonline;
console.log(“url=” + url);
if (url) {
console.log(“inside if = true”);
$w(‘#button51’).expand();
} else {
$w(‘#button51’).collapse();
}
});
})
This just hides the button on every page even if url is present. it comes back as url undefined.
I tried the code above for the image and still hides it on every page
$w.onReady(() => {
$w(“#menudataset”).onReady(() => {
const item = $w(“#menudataset”).getCurrentItem();
if (!item.cafeonline) {
$w(“#button51”).collapse();
}
});
});
Please help!!! the button is more important at this time but i need both to work.


