[Search and Autocomplete] Tab behaviour?

[Search and Autocomplete] Tab behaviour?

Forge Component
Published on 2016-02-15 by Leonardo Fernandes
15 votes
Published on 2016-02-15 by Leonardo Fernandes

Fantastic component firstly!

I have the autocomplete component working well on my app, but there is one thing im having issues with,

If the user clicks/or tabs into the autocomplete and then types a search string, and uses the keyboard to move up/down the result list and then tabs out of the box, the value displayed within the text box is correct, but i dont seem to be able to obtain the actual record they "tab" selected?

The variable that the text field is bound to only shows the text the user typed i.e. if i was searching for Albert and i type 'Alb' then tab out of the field, the value stored in my variable is 'Alb', even though the textbox will show 'Albert'

Moreover the notify widget on the results webblock doesnt capture the selected row either. 

It seems the ONLY way to capture the selection is if the user hits enter or uses the mouse. 

I a trying to make it quick and user friendly i.e. tab in, type something, tab out

Any help would be really appreciated.


Hi Tom. It's probably not a good idea to rely on the text of the search input. Instead, you should build the selection logic on the OnNotify of the Results web block, and there you probably have a stronger identifier for the object the user selected (maybe the entity id?).

The tab behavior seems to be working on the help page (it has lots of demos, a each lesson also lets you download the eSpace to inspect the code). Maybe you should read the lesson 02, and inspect the code that is built. You will see that the Results web block plays a key role, and identifying which item the user has selected should be trivial. If I were you, I would continue reading at least to lesson 03, which teaches you to make your autocomplete reusable, and thus more useful.

Best regards,
Leonardo Fernandes