Replies: 1 comment
-
I'm not sure how useful this will be for you but here is how I got around this issue. In my config I set up the results list as so
Doing this allowed me access to the returned results in my local storage. This way when the user clicks on the search button I can then loop specific data points in each of those returned results after parsing the JSON. Then show the correct results in my desired search field. Note you need to check for blank search box/empty search data or you end up with some odd results like old searches popping up when the field is submitted. ` if (!searchBox.value || !searchedData.length) {
|
Beta Was this translation helpful? Give feedback.
-
My form is pretty simply. It is a text input field with autocomplete and a submit button.
As user enters a state in the field and gets some autocomplete suggestions. The user selects a state and then i am taking the value and doing a GET request to an API endpoint and then displaying some results into a table under the search box.
We have to support multiple ways for the user to interact with the search for accessibility reasons.
Without doing anything special, I see that my code works great doing the following:
From using autocomplete, i see that I can type in my field and i see a list of results. What if my user doesn't select one of those options and instead opts to click the submit button?
Right now i have this eventListener on the submit button.
I think what i want to do is have everything lead to the "selection" section of the autocomplete config. But, how do i hook into that from the submit button?
Anyway, i noticed all of the demos never include a submit button, so I am wondering how to hook it up?
I would actually love to see you add an advanced example with a submit button.
Beta Was this translation helpful? Give feedback.
All reactions