Autocomplete problem - search for value not selected from th


Topic: Autocomplete problem - search for value not selected from the choices dropdown

Admin pro premium priority asked 2 years ago

Expected behavior

Autocomplete dropdown is used as a "suggest" to a search form.

Actual behavior

Autocomplete works fine. If a value is chosen from the dropdown - javascript submits it without a problem. (see the code below)

But, if there is no relevant suggestion from autocomplete - user must be able to submit a query.

If input (search) field contains a custom value (i.e., value not selected from the choices dropdown) then "plain" submit on "Enter" does not work.

How to achieve this behavior?

Note: autocomplete submitting non-predefined value on "Enter" in v.3.9.0 works (without any additional .js code).

Resources (screenshots, code snippets etc.)

asyncAutocomplete.addEventListener('itemSelect.mdb.autocomplete', (e) => { asyncAutocomplete.addEventListener('close.mdb.autocomplete', (e) => { document.getElementById('search').submit(); }) })


mlazaru staff answered 2 years ago

Hi,

check my code and let me know if it helped you:

https://mdbootstrap.com/snippets/standard/mlazaru/4859783#js-tab-view


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 6.1.0
  • Device: Mac
  • Browser: All
  • OS: MacOS
  • Provided sample code: No
  • Provided link: No