How to use Lift’s Auto Complete functionality optionally

Table of contents
Reading Time: 2 minutes

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 tech enthusiast with having around 10 years of experience who loves to solve complex problems with pure quality. He is a functional programmer and loves to learn new trending technologies. His leadership skill is well prooven and has delivered multiple distributed applications with high scalability and availability by keeping the Reactive principles in mind. He is well versed with Scala, Akka, Akka HTTP, Akka Streams, Java8, Reactive principles, Microservice architecture, Async programming, functional programming, distributed systems, AWS, docker.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading