You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by CarlHowarth <ca...@dlapiper.com> on 2007/02/22 10:05:02 UTC

Re: [Solved] "Validation error" "Value is not a valid option" appeared since upgrade to 1.1.5

Further info...

The select one has a list of select items, generated from a map of objects,
using the object's ID as the value and a description property for text. The
map's key value is the ID of the object. This control is still rendered
correctly on page load.

The converter simply does the following:

 public Object getAsObject(FacesContext facesContext, UIComponent
uiComponent, String string)
            throws ConverterException {

       return UtilityClass.getRegionMap().get(Integer.parseInt(string));
    }

    public String getAsString(FacesContext facesContext, UIComponent
uiComponent, Object object)
            throws ConverterException {

        if (object == null) {
            return null;
        } else if (object instanceof Region) {
            final Region region = (Region) object;
            return region.getId().toString();
        }

        return object.toString();
    }

This works correctly when using the MyFaces1.1.4 core, but breaks with the
validation error when I upgraded to 1.1.5. I am also using a snapshot of
tomahawk 1.1.5. When I added logging to the converter it certainly appeared
to be returning the correct values.

I cannot see anything from the release notes that indicates that I need to
change anything to get this to work. Has a problem in my old code been
highlighted (if so, please let me know where I am going wrong!), or is this
a problem with the new release? I am at a loss at the moment, so any ideas
would be hugely appreciated.

Many thanks in advance, Carl




CarlHowarth wrote:
> 
> Hello there,
> 
> I have just upgraded to MyFaces 1.1.5 from 1.1.4 and have come across a
> problem with the UISelectOne component, using a custom converter. When my
> form is submitted I now get a message on screen:
> 
> Validation Error Region List: "regionList": Value is not a valid option.
> 
> Where 'regionList' is the ID of my <h:selectOneMenu ... component.
> 
> The logging on my converter does not highlight anything is untoward. 
> 
> Has anybody else ran into this issue please, and if so could they let me
> know how to get around it?
> 
> Many thanks in advance, Carl
> 

-- 
View this message in context: http://www.nabble.com/%22Validation-error%22-%22Value-is-not-a-valid-option%22-appeared-since-upgrade-to-1.1.5-tf3266228.html#a9096400
Sent from the MyFaces - Users mailing list archive at Nabble.com.