To do what you want to do, you simply specify the form directly where hello.html is ever mounted. I guess this is hello in the same way.
dumbform.html
<div id="main" class="lift:surround?with=default&at=content"> <div> App </div> <div> <form method="post" action="hello"> <table> <tr><td> Email:</td> <td><input name="email" type="text"></td></tr> <tr><td> Password:</td> <td><input name="pwd" type="password"></td></tr> <tr><td> Name:</td> <td><input name="name" type="text"></td></tr> <tr><td><input type="submit" value="Sign in"></td> <td><input type="reset" value="Reset"></td></tr> </table> </form> </div> </div>
hello.html
<div data-lift="ShowHelloSnippet"> <p>Hello <span name="paramname"></span></p> </div>
Excerpt
class ShowHelloSnippet { def render = { "@paramname" #> S.param("name") } }
The greater the way to do this, the better it will be to use Lift SHtml form elements :
dumbform.html
<div id="main" class="lift:surround?with=default&at=content"> <div> App </div> <div> <form method="post" data-lift="FormHandlerSnippet"> <table> <tr><td> Email:</td> <td><input name="email" type="text"></td></tr> <tr><td> Password:</td> <td><input name="pwd" type="password"></td></tr> <tr><td> Name:</td> <td><input name="name" type="text"></td></tr> <tr><td><input id="submitbutton" type="submit" value="Sign in"></td> <td><input type="reset" value="Reset"></td></tr> </table> </form> </div> </div>
Excerpt
class MyFormResponse( var email:String="", var password:String="", var name:String ="") class FormHandlerSnippet { def render = { val responseForm = new MyFormResponse() "@email" #> SHtml.text("", (valueSupplied) => { responseForm.email = valueSupplied }) & "@pwd" #> SHtml.password("", (valueSupplied) => { responseForm.password = valueSupplied }) & "@name" #> SHtml.text("", (valueSupplied) => { responseForm.name = valueSupplied }) & "#submitbutton" #> SHtml.submit("Sign In", () => { S.redirectTo("/hello", () => ShowHelloSnippet.myVals(Full(responseForm))) }) } }
hello.html
<div data-lift="ShowHelloSnippet"> <p>Hello <span name="paramname"></span></p> </div>
Excerpt
object ShowHelloSnippet { object myVals extends RequestVar[Box[MyFormResponse]](Empty) } class ShowHelloSnippet { def render = "*" #> { ShowHelloSnippet.myVals.get.map { r => "@paramname" #> r.name } } }
This will have the given form values ββfor the object, and then perform a stateful redirection that sets values ββin ShowHelloSnippet for use after the page is redirected. As an alternative to both, you can use Ajax to easily display values ββon one page.