# I need help to create a Advanced Search

**URL:** <https://forum.wixstudio.com/t/i-need-help-to-create-a-advanced-search/13286>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [November 28, 2018, 6:58am UTC](https://forum.wixstudio.com/t/i-need-help-to-create-a-advanced-search/13286 "2018-11-28T06:58:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![auscar800](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/auscar800/32/7287_2.png) [@auscar800](https://forum.wixstudio.com/u/auscar800)\
**Post date:** [November 28, 2018, 6:58am UTC](https://forum.wixstudio.com/t/i-need-help-to-create-a-advanced-search/13286/1 "2018-11-28T06:58:17Z")

</div>

Hi,  
I need to add advanced search with one input box and 4 drop downs.  
I able to create fine with search with one input box and one drop down but it’s not working for more drop downs.  
I need help to add more drop dawns for search.

this is my code for one input field and one dropdown

 ![](https://us1.discourse-cdn.com/wix/original/3X/c/d/cd5c802cc50f3b51909ba6b5c1df4813e77eda51.jpeg)

Thank you

---

<div class="post-metadata">

**Author:** ![sapirh](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/sapirh/32/6655_2.png) [@sapirh](https://forum.wixstudio.com/u/sapirh)\
**Post date:** [November 28, 2018, 9:52am UTC](https://forum.wixstudio.com/t/i-need-help-to-create-a-advanced-search/13286/2 "2018-11-28T09:52:46Z")

</div>

Hi,

It’s possible to add more dropdown to your search, you just need to add them to your code the same as you done with the first dropdown.

**First** , add more **loadContinents()** functions according to the number of dropdown you add and include the filed from the collection that you wish to present at each dropdown list.

**Second** , add an onChange() event handler to each dropdown, and call to filter() function with the new parameters you added.

```javascript
For example, if I have two dropdown the prototype function will be:

function filter(title, continent1, continent2)

And these are the event handlers: 

export function dropdown1_change(event) {
  filter(lastFilterTitle, $w('#dropdown1').value, lastFilterContinent2 );
}
export function dropdown2_change(event) {
  filter(lastFilterTitle, lastFilterContinent1, $w('#dropdown2').value);
}

```

- As you can see, I also added a new variable lastFilterContinent2.

Third, rewrite the filter() function again according to your new parameters:

```javascript
Follow the example above:

function filter(title, continent1, continent2) {
 if (lastFilterTitle !== title || lastFilterContinent1 !== continent1 || lastFilterContinent2 !== continent2) {
 
 let newFilter = wixData.filter();
 
 if (title)
      newFilter = newFilter.contains('title', title);
 if (continent1)
      newFilter = newFilter.contains('filed1', continent1);
 if (continent2)
      newFilter = newFilter.contains('filed2', continent2); 
    
    $w('#dataset1').setFilter(newFilter);   
    lastFilterTitle = title; 
    lastFilterContinent1 = continent1;
    lastFilterContinent2 = continent2;
  }
}

```

This video can also be helpful:

[![](https://us1.discourse-cdn.com/wix/original/3X/2/8/28debde4ec57c2912a3d6fb5761adcf652870d23.jpeg "Wix Code | How to Create a Search for Your Database") ](https://www.youtube.com/watch?v=Hx7_8-lRsW0)

Have a nice day, and best of luck!  
Sapir

---

<div class="post-metadata">

**Author:** ![auscar800](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/auscar800/32/7287_2.png) [@auscar800](https://forum.wixstudio.com/u/auscar800)\
**Post date:** [November 30, 2018, 3:02am UTC](https://forum.wixstudio.com/t/i-need-help-to-create-a-advanced-search/13286/3 "2018-11-30T03:02:52Z")

</div>

Hi Sapir,  
Thank you for the reply.  
Finally I able to do it.  
Thank you very much.
