0

I'm facing some problems with this widget:

<h:panelGroup>
                                <p:selectOneRadio required="true"
                                    requiredMessage="Seleziona un elemento"
                                    value="#{createCustomerView.customer.humanSex}">
                                    <f:selectItems value="#{createCustomerView.values}"
                                        var="humanSex" itemValue="humanSex"
                                        itemLabel="#{humanSex.label}" />
                                </p:selectOneRadio>
                            </h:panelGroup>

The problem is that the value is not set into my instance of customer. Where am I wrong? This is the enum used in the selection for the user

public enum HumanSex {

    MAN(1, "Maschio"), WOMAN(2, "Femmina");

    public int id;
    public String label;

    private HumanSex(int id, String label) {
        this.id = id;
        this.label = label;
    }

    private HumanSex() {
    }

    //SET and GETTERS

}
I love coding
  • 1,183
  • 3
  • 18
  • 47
  • @BalusC no one of the link mentioned answer my question, so before report as duplicated check it! If you now the question write the answer... – I love coding Oct 14 '19 at 18:24
  • I think you got confused. Take a deep breath and read them one by one, from top to bottom. The first link is your starting point for these kind of problems of actions not being invoked or values not being set. Item #3 of the first link matches exactly your situation. You should be seeing a validation error but you forgot adding a message component or looking in server logs. Once you've added it, you should see a validation error which is described and explained in the second link. And finally the third link demonstrates the correct approach of using `itemValue` with enums. – BalusC Oct 15 '19 at 11:00

0 Answers0