On Jan 5, 10:18 pm, Naftoli Gugenheim <naftoli...@gmail.com> wrote:
Just move var localNote ... to before def doReply() ...

-------------------------------------


Thanks Naftoli. It does save a reply to the db after I move var
localNote to before def doReply(). But It will only save reply to the
last note even when I try to reply to the note in the top section.

So, in order to see what happend, I add "<lift:embed what="/templates-
hidden/gbook/replyForm" />" no matter the note was replied or not.
When the page loaded, I saw all the textareas in each reply form has
the same reply content of the last note. But both those textareas and
submit buttons have different names. Seems lift doesn't deal the
embeded template content in the snippet properly as wished.

I also test to add "eager_eval="true"" to the list template as:
<lift:GuestBook.list eager_eval="true">. But this won't help.

Thanks for your time. You're so warmhearted. ^_^


  def replyNote(html: NodeSeq): NodeSeq = {

    val localNote = curListNote

    def doReply() = {
      localNote.save
    }

    bind("note", html,
      "replyContent" -> SHtml.textarea(localNote.replyContent,
                                    localNote.replyContent(_)),
      "submit" -> SHtml.submit("Reply", doReply)
    )
  }

  private def getReplyContent(item: GuestNote) = {
    if (item.repliedByAdmin == 0) {
      <div><p>Not replied by admin</p><p>{item.replyContent}</
p><lift:embed what="/templates-hidden/gbook/replyForm" /></div>
    }
    else
      <div><p>{"Replied by admin at: "+item.replyTime}</p><p>
{item.replyContent}</p><lift:embed what="/templates-hidden/gbook/
replyForm" /></div>
  }
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.


Reply via email to