[Lift] Re: toForm on a MappedLongForeignKey
It's older code, so it may be out of date. :( On Jul 11, 1:15 pm, Josh Suereth wrote: > actually, do you need the _toForm in there? If I remove it, it makes a nice > combo box. I think I was just missing the validSelectValues override. > > Thanks again. > > - Josh > > On Sat, Jul 11, 2009 at 11:54 AM, TylerWeir wrote: > > > Something like this? > > > object reportsTo extends MappedLongForeignKey(this, User) { > > override def displayName = "Reports To" > > override def asHtml = { > > {User.find(By(User.id, this)).map(u => > > (u.firstName + " " + > > u.lastName)).openOr(Text("PM"))} > > } > > override def validSelectValues: Box[List[(Long, String)]] = > > Full(User.findAll(OrderBy(User.lastName, Ascending)).map(c => > > (c.id.is, c.niceName))) > > > override def _toForm = { > > Full({User.find(By(User.id, this)).map(u => > > (u.firstName + " > > " + u.lastName)).openOr(Text("No Reports To"))}) > > } > > } > > > On Jul 11, 11:20 am, Josh Suereth wrote: > > > Hey all, > > > > This is my first venture into lift's ORM and I'm upgrading an existing > > > codebase, so I'm not sure how all the pieces fit together, but I've > > figured > > > out enough to patch in my features. I was wondering if someone can help > > me > > > out with this issue: > > > > The code is using the "toForm" method on the objects inside a > > > KeyedMetaMapper. What I want to see for the foriegn key relationship is > > a > > > combo box with a drop-down of the possible values (perhaps with a > > > user-specified toString on those foreign key objects). toForm simply > > > displays: "Can't change" on the MappedLongForeignKey. What/where should > > I > > > look to change this? > > > > Thanks!!! > > > - Josh > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: toForm on a MappedLongForeignKey
actually, do you need the _toForm in there? If I remove it, it makes a nice combo box. I think I was just missing the validSelectValues override. Thanks again. - Josh On Sat, Jul 11, 2009 at 11:54 AM, TylerWeir wrote: > > Something like this? > > object reportsTo extends MappedLongForeignKey(this, User) { >override def displayName = "Reports To" >override def asHtml = { >{User.find(By(User.id, this)).map(u => > (u.firstName + " " + > u.lastName)).openOr(Text("PM"))} > } >override def validSelectValues: Box[List[(Long, String)]] = > Full(User.findAll(OrderBy(User.lastName, Ascending)).map(c => > (c.id.is, c.niceName))) > >override def _toForm = { >Full({User.find(By(User.id, this)).map(u => > (u.firstName + " > " + u.lastName)).openOr(Text("No Reports To"))}) > } > } > > On Jul 11, 11:20 am, Josh Suereth wrote: > > Hey all, > > > > This is my first venture into lift's ORM and I'm upgrading an existing > > codebase, so I'm not sure how all the pieces fit together, but I've > figured > > out enough to patch in my features. I was wondering if someone can help > me > > out with this issue: > > > > The code is using the "toForm" method on the objects inside a > > KeyedMetaMapper. What I want to see for the foriegn key relationship is > a > > combo box with a drop-down of the possible values (perhaps with a > > user-specified toString on those foreign key objects). toForm simply > > displays: "Can't change" on the MappedLongForeignKey. What/where should > I > > look to change this? > > > > Thanks!!! > > - Josh > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: toForm on a MappedLongForeignKey
Exactly! Thanks On Sat, Jul 11, 2009 at 11:54 AM, TylerWeir wrote: > > Something like this? > > object reportsTo extends MappedLongForeignKey(this, User) { >override def displayName = "Reports To" >override def asHtml = { >{User.find(By(User.id, this)).map(u => > (u.firstName + " " + > u.lastName)).openOr(Text("PM"))} > } >override def validSelectValues: Box[List[(Long, String)]] = > Full(User.findAll(OrderBy(User.lastName, Ascending)).map(c => > (c.id.is, c.niceName))) > >override def _toForm = { >Full({User.find(By(User.id, this)).map(u => > (u.firstName + " > " + u.lastName)).openOr(Text("No Reports To"))}) > } > } > > On Jul 11, 11:20 am, Josh Suereth wrote: > > Hey all, > > > > This is my first venture into lift's ORM and I'm upgrading an existing > > codebase, so I'm not sure how all the pieces fit together, but I've > figured > > out enough to patch in my features. I was wondering if someone can help > me > > out with this issue: > > > > The code is using the "toForm" method on the objects inside a > > KeyedMetaMapper. What I want to see for the foriegn key relationship is > a > > combo box with a drop-down of the possible values (perhaps with a > > user-specified toString on those foreign key objects). toForm simply > > displays: "Can't change" on the MappedLongForeignKey. What/where should > I > > look to change this? > > > > Thanks!!! > > - Josh > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: toForm on a MappedLongForeignKey
Something like this? object reportsTo extends MappedLongForeignKey(this, User) { override def displayName = "Reports To" override def asHtml = { {User.find(By(User.id, this)).map(u => (u.firstName + " " + u.lastName)).openOr(Text("PM"))} } override def validSelectValues: Box[List[(Long, String)]] = Full(User.findAll(OrderBy(User.lastName, Ascending)).map(c => (c.id.is, c.niceName))) override def _toForm = { Full({User.find(By(User.id, this)).map(u => (u.firstName + " " + u.lastName)).openOr(Text("No Reports To"))}) } } On Jul 11, 11:20 am, Josh Suereth wrote: > Hey all, > > This is my first venture into lift's ORM and I'm upgrading an existing > codebase, so I'm not sure how all the pieces fit together, but I've figured > out enough to patch in my features. I was wondering if someone can help me > out with this issue: > > The code is using the "toForm" method on the objects inside a > KeyedMetaMapper. What I want to see for the foriegn key relationship is a > combo box with a drop-down of the possible values (perhaps with a > user-specified toString on those foreign key objects). toForm simply > displays: "Can't change" on the MappedLongForeignKey. What/where should I > look to change this? > > Thanks!!! > - Josh --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---