# Search box issue

**URL:** <https://forum.bubble.io/t/search-box-issue/266658>\
**Category:** Questions\
**Created:** [June 8, 2023, 9:02am UTC](https://forum.bubble.io/t/search-box-issue/266658 "2023-06-08T09:02:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![edouardchene](https://avatars.discourse-cdn.com/v4/letter/e/65b543/32.png) [@edouardchene](https://forum.bubble.io/u/edouardchene)\
**Post date:** [June 8, 2023, 9:02am UTC](https://forum.bubble.io/t/search-box-issue/266658/1 "2023-06-08T09:02:36Z")

</div>

Hi Everyone,  
I created a search box in my app in order to check that a data does not exist before creating a new new thing with it in my database.  
To do that I check the “'s value” of the search box because when it finds the value, we can click on it and then it affects a value to it.  
But the problem is that if I fully type a value that already exists in my database without clicking on it when the search box suggests it to me, it considers that it does not exist by not applying a value to the search box.  
Please help 😃

---

<div class="post-metadata">

**Author:** ![paul29](https://avatars.discourse-cdn.com/v4/letter/p/5f8ce5/32.png) [@paul29](https://forum.bubble.io/u/paul29)\
**Post date:** [June 8, 2023, 3:52pm UTC](https://forum.bubble.io/t/search-box-issue/266658/2 "2023-06-08T15:52:26Z")

</div>

This is expected nature of a searchbox so you wont get what you want with this element.

I think you should be able to get what you want with this implementation:  
[(1) Building an Auto-Complete Search Feature on Bubble.io - YouTube](https://www.youtube.com/watch?v=gF8mpZtfWLU)

Basically you’re making your own searchbox

There is the one caveat of the fact that the input box will contain text, which is a different datatype than what you’re searching for. You will need to add some logic to search for (insert data type name here) with a constraint where “name=input’s value”

---

<div class="post-metadata">

**Author:** ![edouardchene](https://avatars.discourse-cdn.com/v4/letter/e/65b543/32.png) [@edouardchene](https://forum.bubble.io/u/edouardchene)\
**Post date:** [June 8, 2023, 7:05pm UTC](https://forum.bubble.io/t/search-box-issue/266658/3 "2023-06-08T19:05:31Z")

</div>

Hi Paul Thanks for your answer.

I thought about it but the problem is that the page for which I need such a search box contains too many pieces of information (but necessaries) with many search boxes. This tutorial is helpful but the page will be too dense to create I think.

Don’t you think that I can affect the SearchBox XXXX’s typed value to a custom state and use it in my workflow? I tried but I can’t affect it to my data type. Even though I affected the text format to my custom state.

 ![Capture d’écran 2023-06-08 à 21.06.01](https://us1.discourse-cdn.com/bubble/original/3X/d/9/d983cb09187f35fc4393652be284128359dc1cb0.png)  
 ![Capture d’écran 2023-06-08 à 21.06.27](https://us1.discourse-cdn.com/bubble/original/3X/d/9/d90ec87bf1d08de630eb2c5ab2a16b114e982385.png)

Maybe the custom state struggle to consider the search box input as a text thing and so I can’t affect it to text data type?

---

<div class="post-metadata">

**Author:** ![paul29](https://avatars.discourse-cdn.com/v4/letter/p/5f8ce5/32.png) [@paul29](https://forum.bubble.io/u/paul29)\
**Post date:** [June 8, 2023, 7:20pm UTC](https://forum.bubble.io/t/search-box-issue/266658/4 "2023-06-08T19:20:34Z")

</div>

You’ll have to do what you want with javascript:

const inputEl = document.getElementById(‘searchBox’);

function logInputChange(event) {  
console.log(event.target.value);  
}

inputEl.addEventListener(‘input’, logInputChange);

Make sure to set this field. This needs to match the above value exactly:

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/5/4/54901c113988f7be11ce8de14a6f07ce86bf0291.png)

---

<div class="post-metadata">

**Author:** ![edouardchene](https://avatars.discourse-cdn.com/v4/letter/e/65b543/32.png) [@edouardchene](https://forum.bubble.io/u/edouardchene)\
**Post date:** [June 8, 2023, 8:05pm UTC](https://forum.bubble.io/t/search-box-issue/266658/5 "2023-06-08T20:05:19Z")

</div>

Thanks a lot for your help but I prefer to avoid Java as I never have used it. I will try to find another way.  
Some people mentioned on the forum two other solutions : use 2 work flow and use the custom states.

> [@Change a Thing with Searchbox input result](http://forum.bubble.io/t/change-a-thing-with-searchbox-input-result/227334):
>
> I 'm new at Bubble! Cant figure out how to save the search input form’s result as either the chosen result that exists in the search or the typed result if it doesnt exist in the search. I am trying to do this in a workflow when the submit button is clicked. I have the search input set to allow entries not in the list while typing. I need this to change a field on a user if it’s typed in or selected from the search and can’t seem to make it work? Any help would be appreciated!

But I don’t know how to create 2 successive workflows in Bubble and I didn’t manage to succeed with the custom states. I will dig into those ideas. Hope that it can work.  
Thanks again!
