I currently have 2 Dataobjects, "Classroom" and "Students". In Classroom, I currently have a working CheckboxsetField that lets me add students to it by getting the names of the students from the Students Dataobject:
$studentlist = DataObject::get("Students");
$mapstudents = $studentlist ? $mapstudents = $studentlist->toDropdownMap('ID','Title') : array();
$fields->addFieldToTab('Root.Main', new CheckboxsetField('App','Apps', $mapstudents));
Since I have a 1:n relation established, each student can only be in 1 classroom (which is what I want). The problem is the CheckboxsetField always shows every student. If I create a new classroom record and select a student that was already in another class, that student is moved to the new record and remove from the previous class.
What I want to happen is the Checkboxset to only show students that haven't been assigned to a classroom.
Any help would be appreciated,