requiredMessage not working in JSF selectOneMenu

0

I have the following requiredMessage

    <h:selectOneMenu class="form-control" id="selectOlhos" value="#{corpoController.corpo.corOlhos}" required="true" requiredMessage="Selecione uma opção.">
        <f:selectItem  itemLabel="Escolha" itemValue="#{null}"></f:selectItem>
        <f:selectItem  itemLabel="Verdes Claros" itemValue="Verdes Claros"></f:selectItem>
        <f:selectItem  itemLabel="Verdes Escuros" itemValue="Verdes Escuros"></f:selectItem>
        <f:selectItem  itemLabel="Castanhos Claros" itemValue="Castanhos Claros"></f:selectItem>
        <f:selectItem  itemLabel="Castanhos Escuros" itemValue="Castanhos Escuros"></f:selectItem>
        <f:selectItem  itemLabel="Indefinido" itemValue="Indefinido"></f:selectItem>
    </h:selectOneMenu>

When the option selected is "Choose", the option is actually validated and does not proceed to the registration, but the validation message does not appear, what can it be?

    
asked by anonymous 18.03.2018 / 16:54

1 answer

0

Try this:

  <f:selectItem  itemLabel="Escolha" noSelectionOption="true" itemValue="#{null}"></f:selectItem>
    
15.05.2018 / 21:25