How to use Lift’s Auto Complete functionality optionally

Auto Complete functionality enables users to quickly find and select from a pre-populated list of values as they type, leveraging searching and filtering.

We can see live example in Google. Whenever we type something for searching, Google provides us some suggestions. This increases the speed of our work.

This functionality is used in 2 forms :
1. Only auto complete is allowed. i.e. We can select only from pre-populated list. We can not enter our own text.
2. Auto Complete as optional i.e. Either we can select from pre-populated list or we can type our own text.

So here I am explaining 2nd feature : Auto Complete with optional

1. Add below line in Boot.Scala

2. In order to implement in Snippet , follow below lines :-

Till now, only populated values can be selected.
3. To make this functionality optional, just add below code :

Auto complete changes id of text box therefore I use “span#autocomplete input” as id to approach that text box.

Now whether select values from populated list or enter your own value, you can access that value in takeAction() method.

Written by 

Rishi is a Lead Consultant, with experience of more than 7 years. Rishi is product focused developer who loves developing both front-end user interfaces and scalable back-end infrastructure. He is a good team player, quick learner and a humble person. He has good time management skills, aimed to give best results and fully dedicated towards his work & responsibilities. He is able to work as individual and as well as in team. He loves to share his knowledge, therefore he often writes technical blogs.

Leave a Reply

%d bloggers like this: