Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
peter-cpx opened this issue May 31, 2024 · 3 comments
Assignees
Labels
bug Solved This ticket has been solved. If it's still open, we're waiting for the user's confirmation.

Comments

@peter-cpx
Copy link
Contributor

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 57ac01d

@sebsoftware
Copy link
Contributor

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.

@stephanrauh stephanrauh self-assigned this Aug 12, 2024
@stephanrauh
Copy link
Collaborator

Your bugfix has landed on Maven Central with version 2.0.0-SNAPSHOPT.

@stephanrauh stephanrauh added the Solved This ticket has been solved. If it's still open, we're waiting for the user's confirmation. label Aug 12, 2024
@stephanrauh
Copy link
Collaborator

See #369 to get instructions on how to get the snapshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Solved This ticket has been solved. If it's still open, we're waiting for the user's confirmation.
Projects
None yet
Development

No branches or pull requests

3 participants