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
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
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”
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.
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?
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:
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.
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!