2 Replies Latest reply on Aug 30, 2013 2:25 PM by daxxy

    rich:picklist validation error?

    daxxy

      I have a picklist and a converter that works Just Fine.  In other words in debug mode I step through and I'm hitting the converter and it's working the way it's converting the string into the DeviceTag object.  But when I submit I get a Validation Error.  No idea why the value being submitted would be invalid.

       

      I have a list of  DeviceTag.java objects I want to move from left to right.  Here is the code:

       

      <rich:pickList value="#{deviceTags.selected}"

        sourceCaption="Select Tags associated with Device"

        addText="Attach to Device" removeText="Remove from Device">

        <f:selectItems value="#{deviceTags.available}" var="_tag"

          itemLabel="#{_tag.tag}" itemValue="#{_tag}" />

        <f:converter binding="#{deviceTagsConverter}" />

      </rich:pickList>

       

      Converter:

       

      @Named
      public class DeviceTagsConverter implements Converter {

          @PersistenceContext
          EntityManager em;

          @Override
          public DeviceTag getAsObject(FacesContext arg0, UIComponent arg1, String label) {
              DeviceTag t = em.find(DeviceTag.class, label);
              return t;
          }

          @Override
          public String getAsString(FacesContext arg0, UIComponent arg1, Object deviceTag) {
              DeviceTag dt = (DeviceTag) deviceTag;
              String tn = dt.getTag();
              return tn;
          }

      }

       

      In response to some things I've found on the net I've done the following:

       

      Made sure everything in the target list is also found in teh source list.

      Overrode equals() method and tested it to be sure it's working.

       

      What else can I check?