On Mon, Aug 31, 2009 at 2:16 PM, xabi <[email protected]> wrote:
>
> Hello!
>
> I've got a problem using SHtml.select and SHtml.selectObj. In my
> little application.
>
> def create(xhtml:NodeSeq):NodeSeq = {
> val teams = Team.findAll
> var localTeam:Team = Team.create
> var visitorTeam:Team = Team.create
> var teamOptions = teams.map(team => (team, team.teamName.is))
>
> def submit () {
> val aMatch = Match.create.local(localTeam).visitor
> (visitorTeam)
> aMatch.save
> }
>
> bind("m", xhtml,
> "local" -> SHtml.selectObj(teamOptions, Empty,
> (team:Team) => localTeam = team),
> "visitor" -> SHtml.selectObj(teamOptions, Empty,
> (team:Team) => visitorTeam = team),
> "submit" -> SHtml.submit("Submit", submit))
> }
> }
>
> When i submit this form, i create a Match mapper object where i set my
> localTeam and my visitorTeam but the visitorTeam is never the one i've
> just chosen in my select.
>
> What is my error?
>
>
No clue. Your code looks reasonable. Just for kicks, change the "visitor"
bind to:
"visitor" -> SHtml.selectObj(teamOptions, Empty, (team:Team) => {
visitorTeam = team; println("Set visitor to "+team)}),
And see if the right or wrong thing gets printed.
> >
>
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://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 [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
-~----------~----~----~----~------~----~------~--~---