Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6071915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:06:07+00:00 2026-05-23T10:06:07+00:00

I have a two stage form which im trying to implement in Lift Scala.

  • 0

I have a two stage form which im trying to implement in Lift Scala. I have the first stage of the form working but the second stage is not working as expected.

The first form asks the user for some input, on submission this will take the user to the second form with the details from the first form shown. The user can enter some text in the textfield and then click submit to view the form results. The second form should be made available to any other users so that they can enter a description for the title given by the initial user.

The way it should work is as follows – user 1 adds a title (form phase one), another user can enter a description (form phase two) and then submit the form to view the results. However, when a user enters the description on form phase two and clicks submit – nothing happens. No redirect and no error.

Any help on this is much appreciated.

My code is below, is this the correct approach?

class TwoPhaseForm extends DispatchSnippet with Logger {
  def dispatch : DispatchIt = {
    case "addformphaseone" => addformphaseone _
    case "viewformphaseone" => viewformphaseone _
    case "addformphasetwo" => addformphasetwo _
    case "viewresults" => viewresults _
  }

  object currentAccountVar extends RequestVar[Entry]({
    Entry.create.author(User.currentUser.open_!)
  })

  def currentAccount = currentAccountVar.is

  //The first part of the form
  def addformphaseone (xhtml : NodeSeq) : NodeSeq = {
    def doSave () = {
      currentAccount.validate match {
        case Nil =>
          currentAccount.save
          S.redirectTo("/viewformphaseone?id=" + currentAccount.id)
        case x => S.error(x)
      }
    }

    val acct = currentAccount

    bind("entry", xhtml,
         "id" -> SHtml.hidden(() => currentAccountVar(acct)),
         "title" -> SHtml.text(currentAccount.title.is, currentAccount.title(_)),
         "submit" -> SHtml.submit("Submit", doSave))
  }

  //view the details from form phase one
  def viewformphaseone(xhtml : NodeSeq) : NodeSeq = {
    val t = Entry.find(S.param("id"))
        t.map(t =>
          bind("entry", xhtml,
           "title" -> t.title.toString,
                )) openOr <span>Not found!</span> <b>Not found!</b>
    }

  //Second phase of the form 

  def addformphasetwo (xhtml : NodeSeq) : NodeSeq = {
    def doSave () = {
      currentAccount.validate match {
        case Nil =>
          currentAccount.save
          S.redirectTo("/results")
        case x => S.error(x)
      }
    }
    val t = Entry.find(S.param("id"))
        t.map(t =>
          bind("entry", xhtml,
          "desc" -> SHtml.text(currentAccount.desc.is, currentAccount.desc(_)),
           "submit" -> SHtml.submit("Submit", doSave) 
                )) openOr <span>Not found!</span> <b>Not found!</b>
  }

  //view the results from both forms
  def viewresults(xhtml : NodeSeq) : NodeSeq = {
    val t = Entry.find(S.param("id"))
        t.map(t =>
          bind("entry", xhtml,
           "title" -> t.title.toString,
           "desc" -> t.desc.toString,
                )) openOr <span>Not found!</span> <b>Not found!</b>
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:06:07+00:00Added an answer on May 23, 2026 at 10:06 am

    a typical school boy error. from the “Exploring Lift book”:

    If the form attribute is included with a value of either “POST” or “GET”, then an appropriate form tag will be emitted into the XHTML using the specified submission method. If you omit this tag from a snippet that generates a form, the form elements will display but the form won’t submit.

    I had missed the form="POST" tag in my html file. Hence the form was not being submited

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two select elements in my form, Category and Sub-category. At first, only
I have two arrays of System.Data.DataRow objects which I want to compare. The rows
At the moment I have two (maybe more) unordered lists which are sortable with
I have a two forms on a page. The first one has several quantity
On a form I have, there are two checkboxes, say Master and Slave. Whenever
I have two forms on one page: a results form and a search form.
I'm trying write a query to find records which don't have a matching record
I have an ASP.NET web form which I am adding a variable number User
I have a form wrapped in two separate div's in order to cause the
I've got a form where I have two radio buttons and two interchangeable controls

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.