2 Replies Latest reply on Sep 7, 2006 1:46 PM by Lukasz Adamus

    UISelectOne: Value is not a valid option.

    Lukasz Adamus Newbie


      I have a big problem with JSF validation. I don't know why but when i submit a form i get "Value is not a valid option" error for h:selectOneMenu control. I'm using @SelectItems binder with my converter:


      <h:selectOneMenu class="configInput"
       <f:selectItems value="#{bankAccountStatusList}"/>

      @SelectItems(valueStrategy=SelectItems.Strategy.OBJECT, labelMethod="getStatusName")
       private List<BankAccountStatus> bankAccountStatusList;
      public void findBankAccountStatuses() {
       bankAccountStatusList = entityManager
       .createQuery("FROM BankAccountStatus bas ORDER BY bas.statusName")

      private BankAccount bankAccount;
      public BankAccount getInstance() {
       return bankAccount;

      static public class BankAccountStatusConverter
       implements Converter, Serializable {
       private static final long serialVersionUID = 3820066884549543875L;
       List<BankAccountStatus> bankAccountStatusList;
       public BankAccountStatusConverter(
       List<BankAccountStatus> bankAccountStatusList){
       this.bankAccountStatusList = bankAccountStatusList;
       public String getAsString(FacesContext facesContext,
       UIComponent component,
       Object obj) {
       if (obj == null) return null;
       BankAccountStatus bankAccountStatus = (BankAccountStatus) obj;
       String val = String.valueOf(bankAccountStatus.getIdBankAccountStatus());
       return val;
       public Object getAsObject(FacesContext facesContext,
       UIComponent component,
       String str) throws ConverterException {
       if (str == null || str.length()==0) {
       return null;
       long id = Long.valueOf(str).longValue();
       for (BankAccountStatus bankAccountStatus : bankAccountStatusList){
       if (bankAccountStatus.getIdBankAccountStatus() == id) {
       return bankAccountStatus;
       return null;

      There is no any exception on console, anything. Only message from JSF that "Value is not a valid option", i don't know how to make it works.

      Please help.