Wix data query to a textbox

Hi guys,

I’m pretty new here and have some knowledge of coding, with that said I’m having problems with the following: I have a database collection and want to connect the different rows to different text boxes/ elements on my web site. So the content would come from the database.

I get this working but only with the first row from the database and can’t select a title or row id in the dropdown under selecting my database connection.

I guess it is possible via wix code.

What I want is a query to the database to get a certain row nr or id, assign it a variable. This variable is then assigned to a textbox or what ever element I want to assign it to. I.e. Then assign #textbox1 to wix-query=“welcome to my site text”

Can someone please help me.

Thank’s

1 Like

Put your matching items from your database collection into a dropdown and then use onChange to filter the dataset

 
export function breadDD_change(event) {
 let bread = $w("#breadDD").value;
    filter(bread); 
}

let FilterDataset1;

function filter(bread) {
 if (FilterDataset1 !== bread) {
 let newFilter = wixData.filter();
 if(bread)
        newFilter = newFilter.eq('breadName', bread);
    $w('#dataset2').setFilter(newFilter);
    FilterDataset1 = bread;
    }
}
1 Like