# What's wrong with that Dropdown search bar code?

**URL:** <https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [August 1, 2019, 2:31pm UTC](https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974 "2019-08-01T14:31:41Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![estefanomarques](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/estefanomarques/32/10970_2.png) [@estefanomarques](https://forum.wixstudio.com/u/estefanomarques)\
**Post date:** [August 1, 2019, 2:31pm UTC](https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974/1 "2019-08-01T14:31:41Z")

</div>

Hi there!

I’m having some trouble trying to code a dropdown search bar. I’m not familiar with codding, I’m codding following tutorials and Corvid’s Doc so I don’t know what’s wrong with code. It’s 4 dropdown with Property, Property Type, City, Bedroom and a Search button. Can you guys help me figure out what’s wrong with code?

* * *

```javascript
import wixData from 'wix-data';

export function button3_click(event, $w) {
    $w("#dataset1").setFilter(wixData.filter()

        .contains("tipoImovel", $w('#dropdown1').value)
        .contains("voceQuer", $w('#dropdown2').value)
        .contains("cidadeDaCasa", $w('#dropdown3').value)
        .contains("quartos", $w('#dropdown4').value)

        .then((results) => {
                console.log("Dataset is now filtered");
                $w("#repeater1").data = results.items
            }).catch((err) => {
                console.log(err);
            });
            $w("#repeater1").expand();
}

```

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [August 1, 2019, 2:52pm UTC](https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974/2 "2019-08-01T14:52:32Z")

</div>

you’re missing a closing parentheses **)** before the **.then**

---

<div class="post-metadata">

**Author:** ![estefanomarques](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/estefanomarques/32/10970_2.png) [@estefanomarques](https://forum.wixstudio.com/u/estefanomarques)\
**Post date:** [August 1, 2019, 3:51pm UTC](https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974/3 "2019-08-01T15:51:24Z")

</div>

It still showing parse error.

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [August 1, 2019, 4:02pm UTC](https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974/4 "2019-08-01T16:02:45Z")

</div>

@estefanomarques check if removing the following line helps:

```javascript
 $w("#repeater1").data = results.items 

```

---

<div class="post-metadata">

**Author:** ![estefanomarques](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/estefanomarques/32/10970_2.png) [@estefanomarques](https://forum.wixstudio.com/u/estefanomarques)\
**Post date:** [August 1, 2019, 5:12pm UTC](https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974/5 "2019-08-01T17:12:32Z")

</div>

@jonatandor35 Still the same.

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [August 1, 2019, 5:14pm UTC](https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974/6 "2019-08-01T17:14:21Z")

</div>

@estefanomarques please add details. Are you getting an error? Which error?

---

<div class="post-metadata">

**Author:** ![estefanomarques](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/estefanomarques/32/10970_2.png) [@estefanomarques](https://forum.wixstudio.com/u/estefanomarques)\
**Post date:** [August 1, 2019, 5:52pm UTC](https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974/7 "2019-08-01T17:52:47Z")

</div>

@jonatandor35 I really don’t know, I followed this tutorial (https://www.youtube.com/watch?v=QhMKnm1f6EU) but the dropdown don’t work, I think it’s missing filters or something like that but I have no clue how to do this! See the link of my website I sent below.

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [August 1, 2019, 6:05pm UTC](https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974/8 "2019-08-01T18:05:57Z")

</div>

@estefanomarques I really can’t help you without more details and without seeing the full page code (I don’t know if you posted all of it).  
However, I can see an error on your site when the page loads.  
This type of error can be caused by wrong collection permissions.  
So check the permissions.

---

<div class="post-metadata">

**Author:** ![estefanomarques](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/estefanomarques/32/10970_2.png) [@estefanomarques](https://forum.wixstudio.com/u/estefanomarques)\
**Post date:** [August 1, 2019, 6:59pm UTC](https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974/9 "2019-08-01T18:59:25Z")

</div>

@jonatandor35 That’s the full code, I’m only using that single code for dropdown searchbox. I’ll check the collection permissions then and probably keeping searching how to fix that. Thanks dude!

---

<div class="post-metadata">

**Author:** ![estefanomarques](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/estefanomarques/32/10970_2.png) [@estefanomarques](https://forum.wixstudio.com/u/estefanomarques)\
**Post date:** [August 2, 2019, 3:54pm UTC](https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974/10 "2019-08-02T15:54:46Z")

</div>

@jonatandor35 Hi J.D. Thank you so much for trying to help me to code the dropdown filter, I figure it out using only Wix settings with no codes, except for the Reset button.

But now I have a different question. I’ve added a code to fadeIn and fadeOut in a button when I scroll the page but when I use the dropdown filter, it still showing the Find More button, even if it doesn’t have new content to load. There’s a code I can add to remove or fadeOut the “Find More” button after loading all the content? The number of items that I set to database is 12. You can test it choosing “Casa” in “Tipo do Imóvel”, “Comprar” in “Você Quer?” and “Ribeirão Preto” in “Cidade”. There’s only 16 repeaters for that search but even after loading all content, it still showing the “Descubra Mais”(Find More) button. And after I click to Reset the search, the Find More function still active, it don’t back to 12, the number of items I setted in database. How can I fix this?

That’s all the coding I’m using:

```javascript
import wixData from 'wix-data';

export function reset_click(event, $w) {

    $w("#dropdown1").value = undefined;

    $w("#dropdown2").value = undefined;

    $w("#dropdown3").value = undefined;

    $w("#dataset1").setFilter(wixData.filter());

}

export function descubra_click(event) {
    $w("#dataset1").loadMore();
}

export function anchor1_viewportEnter(event) {
    $w("#descubra").show("FadeIn");
}

export function anchor1_viewportLeave(event) {
    $w("#descubra").hide("FadeOut");
}

```

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [August 3, 2019, 6:03pm UTC](https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974/11 "2019-08-03T18:03:59Z")

</div>

@estefanomarques maybe try to check if it hasNext after you run a filter.

```javascript
$w("#dataset1").setFilter(wixData.filter())//do it to any other of your filters as well
.then(() => {
$w("#dataset1").hasNext() ? $w("#button1").show() : $w("#button1").hide();
})

```

---

<div class="post-metadata">

**Author:** ![estefanomarques](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/estefanomarques/32/10970_2.png) [@estefanomarques](https://forum.wixstudio.com/u/estefanomarques)\
**Post date:** [August 4, 2019, 2:10am UTC](https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974/12 "2019-08-04T02:10:03Z")

</div>

@jonatandor35 It didn’t work. Sorry, I forgot to post the website link: [https://joyimovadm.wixsite.com/meusite/imoveis-a-venda](https://joyimovadm.wixsite.com/meusite/imoveis-a-venda)

As you can see, everytime you click in “Descubra Mais” (Load More) button and click in “Limpar Seleção” (Reset Dropdown) button, the repeater keeps showing all the contents, it doesn’t reset with dropdown.

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [August 5, 2019, 9:55am UTC](https://forum.wixstudio.com/t/whats-wrong-with-that-dropdown-search-bar-code/16974/13 "2019-08-05T09:55:47Z")

</div>

@estefanomarques I don’t see it
