requiredMessage not working on selectOneMenu JSF

Asked

Viewed 39 times

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, which can be?

1 answer

0

Try this:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.