Hy everyone,
I need to hide a text on a page if a Collection field is null or (in a second case is false).
I’ve been trying for days to readjust similar code found in a post, but I can’t.
Can you please tell me how to correct it?
Thanks in advance as always
This is my try
import wixData from ‘wix-data’;
$w.onReady( function () {
wixData.query(“MemberServices”) //my collection
.eq(“Webinar”, “”) // the field in the collection
.find()
.then( (results) => { let webinarfield = results.items[0].webinarfield; //variable with result of query if (webinarfield === “”){
$w(“#text144”).hide(); // text field in my page
}
} )
. catch ( (err) => { let errorMsg = err;
} );
Hi J.D. and thanks,
but probably i used a bad code for my target.
I need to hide a textbox in a page if in a collection the field is empty or false and not the result of the field in a page. Can you help me again, please?
@info60119 Then do right the same think you already have and query this field in your collection.
And use the Code that J.D. gave you for hidding this Textbox.
Süper easy!
But in this case, I don’t think he meant to query for an empty value at all.
It’s just not clear what Marco was trying to achieve.
Clarification is needed.