Hello all-
I'm having an issue when trying to update a many-to-one collection
attached to a JPA object in Lift. I'm currently using a
SHtml.multiSelect for choosing which objects should be assigned to the
many-to-one collection. My bind statement looks like this:
bind("location", xhtml,
"id" -> SHtml.hidden(() => locationVar(current)),
"name" -> SHtml.text(
location.name,
location.name = _),
"beacons" -> SHtml.multiSelect(choices, default, {bsIds : List
[String] => {
location.beacons.clear
bsIds.map( id => location.beacons.add(Model.getReference(classOf
[Beacon], id.toLong) ) )
} } ),
"save" -> SHtml.submit(?("Save"), doAdd) )
This works great when I'm adding or removing beacons to my location as
long as I don't unselect all options. When I unselect all options, my
closure for the multiSelect doesn't get called so the beacons Set
doesn't get cleared out.
How can I capture when I unselect everything in my multiSelect?
Thanks in advance!
- Aaron