Hi all,
this is my first post, but I read you always, so I apologize if it
appear so simple. I am "tasting" this sensational web framework.

I'll try to explain using a simple and basic example.

Consider a "post" mapper model with a mappedString object named
"permalink"
I'd like to set this db field with something like this (defined in my
snippet)

<pre>
private def set_permalink(input : String) = {
        val pattern1 = """\s+""".r
        val pattern2 = """/[^a-zA-Z0-9_]+/""".r
        pattern1 replaceAllIn(pattern2 replaceAllIn(input.toLowerCase,
""), "-")
    }
</pre>


My snippet look like this

<pre>
class ArticleSnippet extends StatefulSnippet{

....

  var _permalink = S.param("title").map(_.toString) openOr "welcome"

  def add(form: NodeSeq) : NodeSeq = {
    ....

     /** I am in wrong here **/
    val article = Article.create.owner(User.currentUser)
                        
.created_at(entryDate).permalink(set_permalink(_permalink))

    .....

    def doBind(form: NodeSeq) =
      bind("article", form,
           "title" -> post.title.toForm,
           ....
           ....
           "submit" -> submit("Save", ....)
      )

    ....

    }

....
}
</pre>

My saved posts always have "welcome" as value for permalink field.

Could anyone give me any suggestion about it? I appreciate a lot this
group.
Thanks in adavce for your replies.
Regards,
Wibble


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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