# Issue with wix code for dropdown search.

**URL:** <https://forum.wixstudio.com/t/issue-with-wix-code-for-dropdown-search/25710>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [April 20, 2020, 2:45am UTC](https://forum.wixstudio.com/t/issue-with-wix-code-for-dropdown-search/25710 "2020-04-20T02:45:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fiyinoyex](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/fiyinoyex/32/11603_2.png) [@fiyinoyex](https://forum.wixstudio.com/u/fiyinoyex)\
**Post date:** [April 20, 2020, 2:45am UTC](https://forum.wixstudio.com/t/issue-with-wix-code-for-dropdown-search/25710/1 "2020-04-20T02:45:33Z")

</div>

Hello, I wrote a block of codes to create two dropdowns on my wix website and two buttons, one to search the other to reset the selection, when I tested the website the result from the website comes out buggy. Some information is missing that’s meant to be displayed. I don’t know what to do. I really need your help to sort this out, here is the code

import wixData **from** ‘wix-data’ ;  
**let** filter = wixData.filter();

$w.onReady(() =\> {  
**for** ( **let** i = 0 ; i \< 2 ; i++) {  
filter.filterTree.$and[i] = {}  
}  
})

export function button2\_click(event) {  
$w( “#dataset4” ).setFilter(wixData.filter())  
$w( “#dropdown5” ).value = “null” ;  
$w( “#dropdown6” ).value = “null” ;  
$w( ‘#resultTxt’ ).hide();

```
} 

```

**if** ($w( ‘#dropdown5’ ).value.length === 0 ) {

```
    filter.filterTree.$and[3] = {} 

} **else** { 

    filter.filterTree.$and[3] = { "statesLicensedToPracticeIn" : $w( '#dropdown5' ).value };  

} 

```

**if** ($w( ‘#dropdown6’ ).value.length === 0 ) {

```
    filter.filterTree.$and[4] = {} 

} **else** { 

    filter.filterTree.$and[4] = { "therapueticSpecializations" : $w( '#dropdown6' ).value };  

}  

console.log(filter) 

```

$w( “#dataset4” ).setFilter( wixData.filter() );
