@@ -75,7 +75,7 @@ public void takeValuesFromRequest( NGRequest request, NGContext context ) {
7575 final String name = name ( context );
7676 final List <String > valuesFromRequest = request .formValuesForKey ( name );
7777
78- // FIXME: We might have to handle probably have to handle "empty" for the multiple case
78+ // FIXME: We need to handle "empty" for multiple selects. We're currently not handling the "no item selected" case // Hugi 2025-05-25
7979 if ( !valuesFromRequest .isEmpty () ) {
8080 if ( multiple ( context ) ) {
8181 takeMultipleValuesFromRequest ( context , name , valuesFromRequest );
@@ -165,9 +165,17 @@ public void appendToResponse( final NGResponse response, final NGContext context
165165 boolean isSelected = false ;
166166
167167 // FIXME: Hacky way to get the currently selected item. We should be reusing logic from takeValuesFromRequest() here
168+ // FIXME: Handling of multiple selections should really only be in the elements that support those // Hugi 2025-05-25
168169 if ( multiple ( context ) ) {
169170 final List <String > selectedIndexes = context .request ().formValuesForKey ( name ( context ) );
170171 isSelected = selectedIndexes .contains ( String .valueOf ( index ) );
172+
173+ // FIXME: We're doing a separate round here to check for current selections in the associated list. This is spaghetti logic by now, fix up // Hugi 2025-05-25
174+ final List selectedObjects = (List )_selectionsAss .valueInComponent ( context .component () );
175+
176+ if ( selectedObjects != null && selectedObjects .contains ( object ) ) {
177+ isSelected = true ;
178+ }
171179 }
172180 else {
173181 final String indexValue = context .request ().formValueForKey ( name ( context ) );
@@ -177,7 +185,8 @@ public void appendToResponse( final NGResponse response, final NGContext context
177185 }
178186
179187 if ( _selectionAss != null ) {
180- if ( object .equals ( _selectionAss .valueInComponent ( context .component () ) ) ) {
188+ final Object selectedObject = _selectionAss .valueInComponent ( context .component () );
189+ if ( object .equals ( selectedObject ) ) {
181190 isSelected = true ;
182191 }
183192 }
0 commit comments