TheCoder4eu / BootsFaces-OSP

BootsFaces - Open Source Project
Apache License 2.0
247 stars 102 forks source link

SelectOneMenuRenderer throws "Could not match a select item for submittedOptionValue" #1197

Open peter-cpx opened 2 months ago

peter-cpx commented 2 months ago

SelectOneMenuRenderer is not able to match the submittedOptionValue in case complex objects are used as item values.

public class AwesomePerson {
   private String firstName;
   private String lastName;
}
public class MyBean {
   private List<AwesomePerson> selectItems;
   private AwesomePerson selected;
}
<b:selectOneMenu
        value="#{myBean.selected}" ajax="true">
    <f:selectItems value="#{myBean.selectItems}"
                   var="p" itemLabel="#{p.firstName}"/>
</b:selectOneMenu>

In this scenario the item list index is used as submittedOptionValue. Handling of this usecase was removed with https://github.com/TheCoder4eu/BootsFaces-OSP/commit/57ac01d124980790741e506d8c5ce485aafccc60

sebsoftware commented 1 month ago

I detected the same issue. The null check, because null is passed as an empty string, was lost during the converter change.

Even, if there is a fix already available, a note about it.

Another option is to use "omnifaces.selectItemsConverter" which is the option you have to use for i.E. PrimeFaces SelectOneMenu. Even if it is a comfort to have this integrated in the component. On the other hand it is now more compatible with the common.