How to write if statements with text boxes containing URLs

Hey,

We have a great tutorial that shows you how to hide a video player on a page if the video field for an item in a database is empty.

You could follow this tutorial and change it to suit your needs to show a hidden button if the field has a value.

Corvid Tutorial: Hiding a Video Player When There Is No Video to Play

It could end up looking something like this:

$w.onReady(() => {
    $w("#myDataset").onReady(() => {
 // Gets the current item properties and stores them in a variable called item
 const item = $w("#myDataset").getCurrentItem();
 // Checks if the current item has a value in the "url" field
 if (item.url) {
 // Shows the button if there is a value for "url"
            $w("#button").show();
        }
    });
});

You could also do closer to the tutorial and set the button to show on load and then only hide it if the URL field is empty.

Hope this helps!

Dara | Corvid Team