How to hide/show a strip based on database entries?

Hi Bruno,

Thanks for your answer, but it doesn’t work. Both strips are always showing. I also tried to enable/disable a button instead, but it also doesn’t work - the button is always enabled .

import wixUsers from “wix-users” ;
import wixData from “wix-data” ;
import wixLocation from “wix-location” ;

$w . onReady (() => {
$w ( “#dbComp” ). onReady (() => {
toggleButton ()

})
})

function toggleButton () {
let currentUser = $w ( “#dbComp” ). getCurrentItem (). entered
if ( currentUser === “Yes” ) {
$w ( “#btnSubmit” ). disable ()
} else {
$w ( “#btnSubmit” ). enable ()
console . log ( currentUser )
}

}

I also tried this way - but it also doesn’t work;

function checkEntries(){

var user = wixUsers.currentUser;

wixData.query(“CompetitionEntrants”)
.eq(“_id”, user.id)
.find()
.then((result) => {

      if(result.items.length > 0){ 

          var item = result.items[0]; 

          if(item.entered === "Yes"){ 
              $w("#columnStrip1").hide(); 
              $w("#strip2").show(); 
          } else { 
              $w("#columnStrip1").show(); 
              $w("#strip2").hide(); 
          } 
      } 
  }); 

}

When I perform a console.log(currentUser), the developer panel shows “undefined” whether there is an entry in the database or not.

There seems to be an issue with Wix reading the database.

I have double and triple-checked that my field keys are correct, the names of all the elements and databases are correct, and still this is not working.

As I said, I am willing to pay for someone to help me with this as I am desperately running out of time. I have applied on the Wix Partner page, but have not had an answer in over a three weeks.