Phew, that was hard

I've found the problem. In the TD.scala class I had:
def add(form: NodeSeq) {
...

But I should have had:
def add(form: NodeSeq) = {
...

I'm still a complete scala newbie so I don't even sure what's the
difference
but I've just started reading the scala book, so I guess I'll catch it
soon enough.

Thanks.

On Feb 22, 1:21 am, babysnakes <[email protected]> wrote:
> Hi
>
> I'm trying to run the starting guide with version 0.10. When I got to
> the ToDo section (2.11), I got the error above. The page renders all
> the <todo:...> tags instead of replacing them with the 'toForm'
> method.
>
> Here is my relevant files:
>
>  TD.scala
> =======
> package lift.workshop.snippet
>
> import lift.workshop._
> import model._
>
> import net.liftweb._
> import http._
> import SHtml._
> import S._
>
> import js._
> import JsCmds._
>
> import mapper._
> import util._
> import Helpers._
>
> import scala.xml.{NodeSeq, Text}
>
> class TD {
>   def add(form: NodeSeq) {
>     val todo = ToDo.create.owner(User.currentUser)
>
>     def checkAndSave(): Unit =
>       todo.validate match {
>         case Nil => todo.save; S.notice("Added " + todo.desc)
>         case xs => S.error(xs); S.mapSnippet("TD.add", doBind)
>       }
>
>     def doBind(form: NodeSeq) =
>       bind("todo", form,
>         "priority" -> todo.priority.toForm,
>         "desc" -> todo.desc.toForm,
>         "submit" -> submit("New", checkAndSave))
>
>     doBind(form)
>   }
>
> }
>
> index.html
> ========
> <lift:surround with="default" at="content">
>     <lift:Util.out>Please
>         <lift:menu.item name="Login">Log In</lift:menu.item>
>     </lift:Util.out>
>     <lift:Util.in>
>         <lift:TD.add form="post">
>             <table>
>                 <tr>
>                     <td>Description:</td>
>                     <td><todo:desc>To Do</todo:desc></td>
>                 </tr>
>                 <tr>
>                     <td>Priority:</td>
>                     <td><todo:priority>
>                         <select><option>1</option></select>
>                     </todo:priority></td>
>                 </tr>
>                 <tr>
>                     <td>&nbsp;</td>
>                     <td>
>                         <todo:submit>
>                             <button>New</button>
>                         </todo:submit>
>                     </td>
>                 </tr>
>             </table>
>         </lift:TD.add>
>     </lift:Util.in>
> </lift:surround>
>
> = = = = = = = = = = = = = = =
>
> Am I missing something?
>
> Thanks in advance
> --
> Haim

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