Page 1 of 1

Autocomplete

Posted: 2021-05-24 00:45
by Asawyer13
Is there a way to do an autocomplete in a text box? I have 20,000 records that I want to find the record so I can't use a lookup.
Something that shows a list as I type characters so I can find the value I am looking for.

Thanks
Alan

Re: Autocomplete

Posted: 2021-05-25 15:23
by jsetzer
autocomplete in a text box
Lookup fields support searching for items when typing a few characters, by default.

If you need autocomplete in a text-box can you please explain your idea a bit more detailed. Do you mean <input> or <textarea>?

You will need some Javascript on client-side which, after change, triggers an AJAX request, then some PHP on serverside which executes the search on the DV and return a result set as JSON, for example, then some Javascript again to change the text box and the cursor-selection.

Re: Autocomplete

Posted: 2021-05-25 15:41
by onoehring
Hi Alan,

did you try to use a lookup? 20k records sounds much, but as users are able to type the beginning (actually any part) of the string 20k will quickly filter down to just a few.

Olaf

Re: Autocomplete

Posted: 2021-05-27 14:04
by Asawyer13
I was not aware of the lookup feature being able to type a few characters.
Thanks
Alan

Re: Autocomplete

Posted: 2021-05-27 14:12
by Asawyer13
I must be doing something wrong. I have a lookup but when I run the app and go to that field I don't appear to have any way to type in the combobox. It drops down values. For testing I only have a couple items in my combobox which is derived from a SQL query against the database. Is it possible that AG is smart enough to only allow entry if the dropdown contains a certain number of records?

Re: Autocomplete

Posted: 2021-05-28 05:43
by onoehring
Hi,

please see the image - this is how lookups should work (1000 demo records to choose from).
lookup_search.gif
lookup_search.gif (190.62 KiB) Viewed 4634 times
Maybe you could post a screenshot/screencast to show us what happens, when you try to enter something in the field by hand. This might help solving your problem.
Once you (re)gerenate your app, make sure to clear your browser cache ... just to be safe from this direction.

Olaf

Re: Autocomplete

Posted: 2021-05-28 21:31
by Asawyer13
I don't get the box that you are entering your search in. I was using Brave as my browser, but I also tried FireFox and Google Chrome and even MS Edge.


I have a video but don't seem to be able to attach. I will try sending via private message or email if I can find yours.

Re: Autocomplete

Posted: 2021-05-28 21:33
by Asawyer13
I see the attachment now.

I will attach in a minute.

Alan

Re: Autocomplete

Posted: 2021-05-28 21:38
by Asawyer13
It won't attach an mp4.

Re: Autocomplete

Posted: 2021-05-28 21:44
by Asawyer13
Sent Private Message

Re: Autocomplete

Posted: 2021-05-29 08:28
by onoehring
Hi,

this is a very strange behavior. I see the first row in the dropdown is empty - this means, you could select "no doctor". Please try to make the DoctorID REQUIRED (regenerat app, try again).
I did have issues when a dropdown was not a required field (AG sends {empty value} - but currently does not correct this to "NULL" in the database. I reported it here viewtopic.php?f=11&t=4085 and think it still exists in 5.96, currently latest version)

In cases I need such a field, I add "-" as new value to the lookup source and make sure, it's the first value shown. Choosing "no doctor" could also be "-no doctor-" and also be the first entry. Maybe this solves the problem.

Please try to make it a required, regenerate and test if it's possible to search then.
Please also try another browser.
Well: What AppGini version are you using?

PS: You could make the video available to others by simply posting the link here.
PSPS: I often use the free Screen2Gif ( https://www.screentogif.com ) for demo (as above).

Olaf

Re: Autocomplete

Posted: 2021-05-29 15:41
by Asawyer13
I will try your suggestion.
I am using V5.96 and tried Brave, Firefox and Chrome.

Re: Autocomplete

Posted: 2021-05-29 18:56
by aarlauskas
Try entering lets say 15 items in your lookup. There is a minimum number of items needed before it starts filtering, which you can set. I think you need minimum 5 before you can search for item in lookup

Re: Autocomplete

Posted: 2021-05-29 19:04
by Asawyer13
aarlauskas wrote:
2021-05-29 18:56
Try entering lets say 15 items in your lookup. There is a minimum number of items needed before it starts filtering, which you can set. I think you need minimum 5 before you can search for item in lookup
Thanks, that was it. I entered 4 and it works. Makes perfectly good sense since it really wouldn't be needed if the dropdown is a small number of items.

Solved..

Alan

Re: Autocomplete

Posted: 2021-05-29 19:13
by aarlauskas
Awesome, glad all solved ;)