0 Replies Latest reply on Nov 18, 2011 3:58 AM by couse1

    validation error: value not valid when list is empty

    couse1 Newbie

      Hi,

       

      My rich:inplaceselect and my a a4j:commandbutton :

       

      ...
      <rich:inplaceSelect id="selectTitre"
          
          rendered="#{administrationController.ipsTitre}"
          value="#{administrationController.titreId}" required="true"
          requiredMessage="Sélectionner une valeur"
          valueChangeListener="#{administrationController.listModifTitre}">
          <f:selectItems value="#{administrationController.titresList}" />
          <a4j:ajax event="change" render="pgAjouterTitre supprimer"
              execute="@this" />
      </rich:inplaceSelect>
      <h:message for="selectTitre" />
      ...
      <a4j:commandButton id="supprimer" value="DELETE"
          action="#{administrationController.supprimer}"
          execute="#{administrationController.executeAjmosu}" />
      ...
      

       

       

       

      when there are datas in my rich:inplaceselect, i can delete them with the a4j:commandbutton, but when the list is empty(rich:inplaceselect) i 've this error :

       

      validation error: value not valid

       

      And i 'd like to avoid this error when a user click on the button.

       

      The code in my managed bean (viewscoped)  to delete :

       

      titreBean.supprimer(Integer.parseInt(titreId));

       

       

      The code in my bean :

       

      public void supprimer(Integer id){

              TitreEntity titre = em.merge(em.find(TitreEntity.class, id));

              em.remove(titre);

          }

       

       

      Any ideas?

      Thanks in advance for your reply

      Couse1