Autocomplete - 'Not found' not available if source empty

Wappler Version : 3.7.2
Operating System : Big Sur
Server Model: PHP
Database Type: MySQL
Hosting Type: AWS/Docker

Expected behavior

What do you think should happen?

The ‘not found’ message should appear to be able to add a value using the new dynamic event.

Actual behavior

What actually happens?

If the source array is empty, the not found message doesn’t appear so the user cannot add a new value.

How to reproduce

  • Detail a step by step guide to reproduce the issue
  • A screenshot or short video indicating the problem
  • A copy of your code would help. Include: JS, HTML.
  • Test your steps on a clean page to see if you still have an issue

Add a text input
Set to autocomplete
Use a datasource that produces an empty array

I am not sure i understand your idea here. You are using a data source, but it has no values? What’s the point of that?

Because sometimes the list that you want to choose from starts empty until a user has added their first one.

Wouldn’t it be more logical to not show autocomplete if the data source is empty? You can use a conditional region to show/hide it depending on this.

[conditional region -> your datasource has items] 
<autocomplete>
[conditional region]
[conditional region -> your datasource does not have items] 
<text input (to insert values)>
[conditional region]

You could do it that way.
I would have thought, though, that typing anything into an autocomplete where there’s no matches (because it’s empty) would invoke the not found element. Your method, while absolutely valid, seems slightly long-winded compared to having the same method on a single autocomplete element. I’m sure there’s lots of people who want to use it for tags, lists etc. that might start from an empty source so being able to handle it without conditional regions, IMHO, makes more sense.

bump

can this please be looked at?

Please test the following update.

dmxAutocomplete.zip (2.2 KB)

1 Like

Very quick test, but seems to work like a dream! Thank you so much!

Will this be going into the next release? I got round it by add an append to the input field which looked like a + button and had a click event to open a modal to add a record purely for when there are no results. Your update is much better.

Yes, when there are no issues found then it will be included in the next Wappler update.

This has been fixed in Wappler 3.8.2

1 Like

This topic was automatically closed after 45 hours. New replies are no longer allowed.