Here's my code sample that illustrates the problem:

class UserView(entity:User, snippet:ManageUsers) extends ModelView
[User](entity, snippet){
  override val editAction = TheBindParam("edit", snippet.link("edit",
()=>load, Text(S?("Edit Roles"))))

  val addRole = TheBindParam("insert", snippet.link("edit", ()
=>insertRole , Text(S?("Add Role"))))
  val saveUser = TheBindParam("submit", snippet.link("list", ()
=>save , Text(S?("Save"))))

  def insertRole = {
      val r = new Role
      r.save
      entity.roles += r
      save

    }
}


class ManageUsers extends ModelSnippet[User]{
   val myView:UserView = new UserView(new User, this)
   val view: ModelView[User] =  myView



  /**
   * The list snippet
   */
  def list(ns: NodeSeq): NodeSeq =  User.currentUser.map({user =>

        User.findAll.flatMap({u =>
            val v = new UserView(u, this)
            v.load
            val e = v.entity
            bind("user", chooseTemplate("user", "entry", ns),
                 "firstname" -> Text(e.firstName.is),
                 "lastname" -> Text(e.lastName.is),
                 "email" -> Text(e.email.is),
                 "roles" -> e.roles.map(_.name.toString).mkString(",
"),
                 v.editAction,
                 v.removeAction
                 )
          })
                        }) openOr Text("You're not logged in")




  /**
   * The edit snippet
   */
  def edit(ns: NodeSeq): NodeSeq =  {

            val theUser = myView.entity

            bind("user", ns,
                 "name" -> Text(theUser.firstName.is + " " +
theUser.lastName.is),
                 "roles" -> theUser.roles.flatMap({role =>
                      bind("role", chooseTemplate("role", "entry", ns),
                          "name" -> role.name.toForm,
                          "remove" -> SHtml.submit(S?("Remove"), ()=>
theUser.roles -= role)
                      )
                  }),
                 myView.addRole,
                 myView.saveUser

                 )


    }


The addRole and saveUser links generate the error. I even tried using
SHtml.link instead of StatefulSnippet.link and
it made no difference. The links append a different function map
parameter to the URL, when what I think I really need
is just the link, /edit,  not something like this:
http://localhost:8080/edit?F54610774551004F=_.

Does any of this make sense?

On Aug 7, 8:41 am, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> On Thu, Aug 6, 2009 at 3:09 PM, glenn <gl...@exmbly.com> wrote:
>
> > I have a stateful snippet with multiple StatefulSnippet links in the
> > bind helper. Clicking on each link gives me a
> > 403 error. I noticed that the function map for each link is different.
> > Shouldn't they be the same, since I'm trying to reload the same page
> > as the one the link is on?
>
> Can you post an example based 
> onhttp://github.com/dpp/lift_1_1_sample/tree/masterthat demonstrates the
> problem?
>
>
>
> > Glenn...
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> 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 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