Hello,
I need help, can you help me?
I would like to pass a button which allows to display documents in disabled mode if there is no file in the database.
How to do ?
Thank you
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 disable a button if there is no document.
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 "document" field
if (!item.document) {
// Disables the button if there is no value for "document"
$w("#button1").disable();
}
});
});
Hope this helps!
Dara | Corvid Team