Try this:

  def create(xhtml: Group): NodeSeq = {
    def redo(b: Blog)(n: NodeSeq): NodeSeq = table(b.toForm(Full("Create"),
redo(b), handleSubmit _))

   User.currentUser.map(_.createBlog) match {
     case Full(b) => redo(b)(xhtml)
     case _ => S.warning("There's no user logged in"); NodeSeq.Empty
   }
  }

The redo(b) function is the thing that generates the form.  On failure, it
calls itself with the in-process blog.

Thanks,

David

On Wed, Nov 12, 2008 at 1:40 AM, Joachim A. <[EMAIL PROTECTED]>wrote:

>
> Hi,
> I'm still a Scala and Lift novice but I really like what I see so far.
> I'm using 0.10-SNAPSHOT.
>
> I have a database entity called "Blog". For a new instance "blog" I
> show the form with b.toForm(). I've found the redo snippet parameter.
>
> If the data was invalid for the submit, redo is executed. But now the
> original data is lost.
>
> 1. How can I show the data the user entered in the form?
>
> 2. What does the NodeSeq parameter for the redoSnippet do? For now I
> just passed it on.
>
> 3. How do you put the error message to the field?
>
>
> Here's my code (snippet class BlogUtils):
>    def create(xhtml: Group): NodeSeq = {
>        def redo(n: NodeSeq) = this.create(<xml:group>{n}</xml:group>)
>
>        User.currentUser.map(u => {
>            val b = u.createBlog
>            table(b.toForm(Full("Create"), redo _, handleSubmit _))
>        }) openOr {S.warning("There's no user logged in.");
> NodeSeq.Empty}
>    }
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to