Lift the redirect to a new page after submitting the form with the parameters

How to transfer the results of submitting the form to the page I'm redirecting to?

For example, let's say I have the following logic:

Search Page -> validate

if errors - show Search Page again with errors   <--- this part works
else - redirect to New Page(passing search params)  <-- no params passed

My form processing looks something like this:

  def process() = {
    if (nameame== "Joe") {
      S.error("Joe not allowed!")
    }
    val dateRegex="(\\d\\d/\\d\\d/\\d\\d\\d\\d|\\w*)";

    if (!birthdate.matches(dateRegex)) {
      S.error("birthdate", "Invalid date. Please enter date in the form dd/mm/yyyy.")
    }

    S.errors match {
        case Nil =>S.notice("Name: " + name); S.redirectTo("search-results")
        case _ =>S.redirectTo(S.uri)
    }
  }

As you can see, my search results do not get the name or date of birth parameters. How to pass parameters from a form when calling S.redirectTo ?

Let me know how I can somehow clarify the issue.

+5
source share
1 answer

SessionVar search_results , . . http://stable.simply.liftweb.net/#toc-Section-4.4.

:  

S.redirectTo("search-results?param1=value1") //Not very clean though
+1

All Articles