Sometimes a single page form is all that you need to get your job done, but there are times when we need more. In such situations, we need an easy way to deal with multipage forms; this means that we need a way to keep the values between the pages, a way to validate all fields, pages and so on, and a way to change the flow of the form based on how the user filled in some fields.
Lift provides a powerful and flexible tool to accomplish this. It is called Wizard
.
In this section, we will learn how to create a multipage form using Wizard
. We will start with preparing our application to be able to use Wizard
.
Create a new project.
Add
lift-wizard
as a dependency by adding the following line intolibraryDependencies ++= Seq
in thebuild.sbt
file:"net.liftweb" %% "lift-wizard" % liftVersion % "compile"
Add the following code into the
div
tag withmain
as the value of theid
field in theindex.html
file:<div class="lift:MultiPageForm">...