how we can get the result of two dropdown in text.

Like i have data in three columns and i choose two dropdowns and one text box.
Below is coding for two dropdown


import wixData from ‘wix-data’;

$w.onReady(function () {
uniqueDropDown1();

});
function uniqueDropDown1 (){
wixData.query(“List_of_Items”)

    .limit(1000) 

  .find() 

  .then(results => { 

       const uniqueTitles = getUniqueTitles(results.items); 

       $w("#dropdown1").options = buildOptions(uniqueTitles); 

  }); 

function getUniqueTitles(items) {

    const titlesOnly = items.map(item => item.cateogry); 

 return [...new Set(titlesOnly)]; 

} 

function buildOptions(uniqueList) { 

    return uniqueList.map(curr => { 

        return {label:curr, value:curr}; 

    }); 

} 

}

export function dropdown1_change(event, $w) {

uniqueDropDown2();

$w(“#dropdown2”).enable();

}

function uniqueDropDown2 (){

wixData.query("List_of_Items") 

    .contains("cateogry", $w("#dropdown1").value) 

    .limit(1000) 

  .find() 

  .then(results => { 

       const uniqueTitles = getUniqueTitles(results.items); 

       $w("#dropdown2").options = buildOptions(uniqueTitles); 

  }); 

function getUniqueTitles(items) {

    const titlesOnly = items.map(item => item.type); 

 return [...new Set(titlesOnly)]; 

} 

function buildOptions(uniqueList) { 

    return uniqueList.map(curr => { 

        return {label:curr, value:curr}; 

    }); 

} 

}
I need to know how i can take the result in text format which is available in the third column.
both of the dropdown are working perfectly okay.

Hi,

You can use the code below. Create an onChange event handler on your textbox. In the event handler take the new value from the event object and put it in a variable for you to use.

$w ( “#myTextBox” ). onChange ( ( event ) => {
let newValue = event . target . value ; // “new value”
});

Good luck,
Asaf

Hi Asaf,

Thanks for your help.
i’m facing error, can you please write the remaining code if possible.
Many Thanks in advance.