Wix Data Query - Preventing Data Appearing Unless All FIelds Input

Good morning all,

Would anyone happen to know how to prevent table data appearing without all fields being input?

I have two drop down boxes and a post code text input and if the drop down boxes have options selected but not a post code input, it displays the entire database of information.

I want to prevent the search running (which is carried out by clicking a button) unless at least both drop boxes and post code is input.

Thank you in advance,

Kind regards
James

Hello

You can simply disable the button and when all fields are input enable it.
Or you can add an if statement inside the button click event:

export function button1_click(event) {
 //Add your code for this event here: 
 if ($w('#dropdown1').value && $w('#dropdown2').value && $w('#input1').value) {
 // add the code to show the table data here
    }else{
        console.log("error! fill all fields")
    }
}

Best
Massa

Excellent, worked a treat. Thank you Massa