Choices url on a textbox : set autocompletion manually

Use this board to ask questions or have discussions with other Rich Displays users.
mgardes
New User
Posts: 9
Joined: Thu Nov 22, 2018 10:56 am
First Name: Maximilien
Last Name: G.
Company Name: SERMES
City: Strasbourg
Country: France
Contact:

Choices url on a textbox : set autocompletion manually

Post by mgardes »

Hello

In a Rich Display File i have a textbox autocompleted by using the "Choices url" property (with a json list geted with Universal Handler);
It works well.

But i would like that the autocompletion does not start atomatiquely but manually using javascript (on the onkeyup event for exemple) to add a setTimeout/clearInterval functionnality to avoid the search programm to be called when the user type very fastly a word in the textbox.

Does someone coud say me how to do please ?

Thank you very much
User avatar
matt.denninghoff
Profound Logic Staff Member
Posts: 115
Joined: Wed Feb 10, 2016 3:53 pm
First Name: Matthew
Last Name: Denninghoff
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: Choices url on a textbox : set autocompletion manually

Post by matt.denninghoff »

Hi,
Currently, there is a 200 millisecond delay between the keyup event and when the AJAX request is sent to your Universal Display File program. The 200ms delay happens internally with the Autocomplete via setTimeout. That means, when a user types quickly (without 200ms expiring between key strokes), then fewer AJAX requests are sent.

There's not currently a way for you to change that 200ms delay or to run some custom JavaScript to run before the AJAX request. However, it would be easy for Profound to add an option to our product to allow the delay to be changed. If that config option is something you'd be interested in, you can request a feature by emailing support@profoundlogic.com.
mgardes
New User
Posts: 9
Joined: Thu Nov 22, 2018 10:56 am
First Name: Maximilien
Last Name: G.
Company Name: SERMES
City: Strasbourg
Country: France
Contact:

Re: Choices url on a textbox : set autocompletion manually

Post by mgardes »

Thanks a lot Matt for all theese informations.

The problem is not the delay but the comportement.

when the user types quickly, the most important step is the last one and not the older one. Each time a key is up it should cancel the last ajax request timeouted via a clearInterval if this one has not been executed yet) . That means that, as long as you quickly type keys, its should cancel all the ajax requests exepted the last one when you stop. This is not what happens today.

Today, when you type quickly, most of the time, your last keys are not "taken in account"

if i type "maximilien" very quicly today it searchs "m", "max", "maximli" (and not "maximilien") but it should only search "maximilien" because the last letter is the first one after which there is a delay before the next letter.

Do you agree ?

PS : i hope my english is clear enough
User avatar
matt.denninghoff
Profound Logic Staff Member
Posts: 115
Joined: Wed Feb 10, 2016 3:53 pm
First Name: Matthew
Last Name: Denninghoff
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: Choices url on a textbox : set autocompletion manually

Post by matt.denninghoff »

Your English is clear to me. I'm sorry--my answer was not complete: if the user types before the delay/timeout expires, then clearTimeout() is called, and the earlier keystrokes should not each fire the event that makes the AJAX. So, if you type quickly enough (with less than 200ms between each keystroke), AutoComplete is coded to only fire the AJAX request once.

In my testing, the AJAX calls happen as I described if I type very quickly. However, I'm seeing that 200ms is very short. It's very hard for me to type "maximilian" without a 200ms delay after any of those keys. (I can type "matthew" fast enough:) The timeout should probably be increased to 500ms--or better yet, be configurable. I can put in a feature request if you'd like.
mgardes
New User
Posts: 9
Joined: Thu Nov 22, 2018 10:56 am
First Name: Maximilien
Last Name: G.
Company Name: SERMES
City: Strasbourg
Country: France
Contact:

Re: Choices url on a textbox : set autocompletion manually

Post by mgardes »

Thank you so much Matthiew.

I understand the behavior better.
On the other hand, I come to understand that the problem also comes from elsewhere by carrying out new tests:
Look at the attached image:
When I type "39306" normally, this triggers 5 searches: "39", "393", "3930", "39306" and again "39306". I see it by looking at the content of the POST variables of the queries. We see them below in the order of tripping.

When we look at the bottom queries, we see that they are asynchronous and that the answers do not arrive in the same order.
Typing 39306 I first see the results of "3930" (the third), then "393" (the second), then "39306" (the 4th and 5th) and suddenly I see the results of " 39 "because it is the query that has taken the most time. This is not the expected behavior at all.

We have just done tests with different delays (300ms, 400ms, 500ms) by temporarily modifying the file "runtime.js". It's better because suddenly there are fewer requests. So please ask for the opportunity to customize this time. It will be very good.

On the other hand it still happens that the answers do not arrive in the right order and that the results do not suffice the good ones. An idea to avoid this?
Attachments
Capture.JPG
Capture.JPG (155 KiB) Viewed 3149 times
User avatar
matt.denninghoff
Profound Logic Staff Member
Posts: 115
Joined: Wed Feb 10, 2016 3:53 pm
First Name: Matthew
Last Name: Denninghoff
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: Choices url on a textbox : set autocompletion manually

Post by matt.denninghoff »

The results arriving out of order is unusual, but the AutoComplete code isn't coded to prevent it. If we're adding the configuration option to specify the delay, we may as well look at the out-of-order problem, too. I don't think there's a way to solve the out-of-order problem without us changing the code, so I'll make a ticket and add both problems to it. I'll let you know next week what our developers decided on it.
mgardes
New User
Posts: 9
Joined: Thu Nov 22, 2018 10:56 am
First Name: Maximilien
Last Name: G.
Company Name: SERMES
City: Strasbourg
Country: France
Contact:

Re: Choices url on a textbox : set autocompletion manually

Post by mgardes »

great !!! Thanks a lot, one more time !
User avatar
matt.denninghoff
Profound Logic Staff Member
Posts: 115
Joined: Wed Feb 10, 2016 3:53 pm
First Name: Matthew
Last Name: Denninghoff
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: Choices url on a textbox : set autocompletion manually

Post by matt.denninghoff »

Hello. The results arriving out of order is a bug. I've fixed it, but for bugs, those should normally be reported to support@profoundlogic.com. Please contact Support and ask for a patch for issue #5136, or you can wait for the next release of Profound UI.

I also added a configuration option, pui["autocomplete typeahead delay"], which will be available in the next release or the same patch. See http://www.profoundlogic.com/docs/displ ... head+Delay for how it will be used.
mgardes
New User
Posts: 9
Joined: Thu Nov 22, 2018 10:56 am
First Name: Maximilien
Last Name: G.
Company Name: SERMES
City: Strasbourg
Country: France
Contact:

Re: Choices url on a textbox : set autocompletion manually

Post by mgardes »

Great. Thanks a lot.

Mail sended to have a patch.
mgardes
New User
Posts: 9
Joined: Thu Nov 22, 2018 10:56 am
First Name: Maximilien
Last Name: G.
Company Name: SERMES
City: Strasbourg
Country: France
Contact:

Re: Choices url on a textbox : set autocompletion manually

Post by mgardes »

The patch works perfectly. Great job. Thank you so much.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests