Autocomplete

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
Asawyer13
Posts: 21
Joined: 2016-08-28 22:40

Autocomplete

Post by Asawyer13 » 2021-05-24 00:45

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

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Autocomplete

Post by jsetzer » 2021-05-25 15:23

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.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Autocomplete

Post by onoehring » 2021-05-25 15:41

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

Asawyer13
Posts: 21
Joined: 2016-08-28 22:40

Re: Autocomplete

Post by Asawyer13 » 2021-05-27 14:04

I was not aware of the lookup feature being able to type a few characters.
Thanks
Alan

Asawyer13
Posts: 21
Joined: 2016-08-28 22:40

Re: Autocomplete

Post by Asawyer13 » 2021-05-27 14:12

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?

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Autocomplete

Post by onoehring » 2021-05-28 05:43

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 2914 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

Asawyer13
Posts: 21
Joined: 2016-08-28 22:40

Re: Autocomplete

Post by Asawyer13 » 2021-05-28 21:31

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.

Asawyer13
Posts: 21
Joined: 2016-08-28 22:40

Re: Autocomplete

Post by Asawyer13 » 2021-05-28 21:33

I see the attachment now.

I will attach in a minute.

Alan

Asawyer13
Posts: 21
Joined: 2016-08-28 22:40

Re: Autocomplete

Post by Asawyer13 » 2021-05-28 21:38

It won't attach an mp4.

Asawyer13
Posts: 21
Joined: 2016-08-28 22:40

Re: Autocomplete

Post by Asawyer13 » 2021-05-28 21:44

Sent Private Message

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Autocomplete

Post by onoehring » 2021-05-29 08:28

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

Asawyer13
Posts: 21
Joined: 2016-08-28 22:40

Re: Autocomplete

Post by Asawyer13 » 2021-05-29 15:41

I will try your suggestion.
I am using V5.96 and tried Brave, Firefox and Chrome.

User avatar
aarlauskas
Veteran Member
Posts: 127
Joined: 2019-04-28 18:03
Location: Medway, UK

Re: Autocomplete

Post by aarlauskas » 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

Asawyer13
Posts: 21
Joined: 2016-08-28 22:40

Re: Autocomplete

Post by Asawyer13 » 2021-05-29 19:04

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

User avatar
aarlauskas
Veteran Member
Posts: 127
Joined: 2019-04-28 18:03
Location: Medway, UK

Re: Autocomplete

Post by aarlauskas » 2021-05-29 19:13

Awesome, glad all solved ;)

Post Reply