Hi everyone, I’m pretty new to code and in need of a little help. I have a text field connected to my database, I would like my button to only submit the data once. Is there a way to hide or disable a button once data has been entered into my database?
Hi Heath, thank you for the links above! I was able to figure it out because of them.
I’m creating a games tournament page for players to play one another, so it was vital that the form submission closed off when a single player joins the event. To achieve this I wanted to hide the form button whenever my database exceeds 1 user.
To achieve this I used the following code:
import wixData from ‘wix-data’;
$w.onReady( function () {
//TODO: write your page related code here…
wixData.query(“gunfightDB1”) //change to your custom database id
.find()
.then( (results) => {
if (results.items.length > 0 ) {
$w(“#button4”).hide();
}
console.log(results.items);
} );
});
thanks again Heath,
Niall.