AlessioB free asked 3 years ago


Is there a way to intercept the entry of a value not included in the autocomplete list?

I'm triyng to manage the search input change event + itemSelect.mdb.autocomplete not fired event. Is this the right way?

Thanks, Ax


AlessioB free answered 3 years ago


Shure!

I have an async autocomplete element where user search for the existence of an object. If the text typed don't match any object in DB the user can continue, otherwise happen something else. So, the question is: how I can handle the empty results list? In fact the itemSelect.mdb.autocomplete event won't fired in case of no choice.

The example can be: the list of values for the autocomplete is a list of numbers from 1 to 5. The user enters 6. How do I intercept this user choice?

I managed this checking the input change event waiting two tenths of a second, just to see if itemSelect.mdb.autocomplete do his work, if notting happens, the choice isn't in the DB.

I hope I was clear

Thanks, Ax


parson premium commented 3 years ago

Could you add a check in update.mdb.autocomplete for an empty result and go from there?


Michał Duszak staff commented 3 years ago

Just like @parson said: here's a snippet https://mdbootstrap.com/snippets/standard/m-duszak/3406228#js-tab-view


AlessioB free answered 3 years ago


Thanks. Works perfectly!


Michał Duszak staff answered 3 years ago


Hello, Ax! I don't quite understand what are you trying to achieve. Can you please tell me some more details?

Thank you for reaching us! Best regards,

Michal



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

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.9.0
  • Device: PC
  • Browser: Edge
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No