Hello everybody,

I'm fairly new to lift (and to scala, to be honest), and just trying
to find my way around. So far I like what I'm seeing and deing, but
some things keep me puzzled.

Short version of my confusion: Is
<lift:snippet type="SiteOps.add" form="post">...</lift:snippet>
equivalent to
<lift:SiteOps.add>...</lift:SiteOps.add>
?

Long version:
I was trying to implement a typical entry-form for database entities.
The model classes for the database entities have a variety of
verification checks. When checks fail, the form should be redisplayed,
with the previously entered (and probably erroneous) values filled in.
My snippet is pretty much a mixture of the various examples and the
starter guide:

def add(form: NodeSeq) = {
    val invokedAs = S.invokedAs
    val site = Site.create

    def newSite(form: NodeSeq): NodeSeq = {
      def saveMe(): Unit = {
        site.validate match {
          case Nil => site.save ; S.notice("Added " + site.name);
S.redirectTo("/sites/")
          case xs => S.error(xs) ; S.mapSnippet(invokedAs, newSite)
        }
      }

      bind("site", form,
           "name" -> site.name.toForm,
           "abbreviation" -> site.abbreviation.toForm,
           "submit" -> SHtml.submit("New", saveMe))
    }

    newSite(form)
  }

With the <lift:snippet type="SiteOps.add" form="post"> style tags,
everything works as expected (form fields are populated after a failed
validation). If I use <lift:SiteOps.add>, the form comes up empty
after a failed validation. What am I getting wrong?

Thanks in advance!

Best,
Clemens

--~--~---------~--~----~------------~-------~--~----~
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