You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Ondrej Svetlik (JIRA)" <de...@myfaces.apache.org> on 2007/09/24 10:06:50 UTC

[jira] Created: (MYFACES-1730) When validating select items use converter on both sides

When validating select items use converter on both sides
--------------------------------------------------------

                 Key: MYFACES-1730
                 URL: https://issues.apache.org/jira/browse/MYFACES-1730
             Project: MyFaces Core
          Issue Type: Bug
    Affects Versions: 1.1.5
            Reporter: Ondrej Svetlik


I'm using converters to convert enums to Strings and back and I get a validation error that "Value is not a valid option."

in class javax.faces.component._SelectItemsUtil
there is

    public static boolean matchValue(Object value,
                    Iterator selectItemsIter)
    {
        while (selectItemsIter.hasNext())
        {
            SelectItem item = (SelectItem) selectItemsIter.next();
            if (item instanceof SelectItemGroup)
            {
...
            }
            else
            {
                Object itemValue = item.getValue();
// here itemValue is a String but value (submited value) is already converted do my Enum<E>
                if (value==itemValue || value.equals(itemValue))
                {
                    return true;
                }
            }
        }
        return false;
    }
}

I cannot override the Enum.equals() method because it is final.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-1730) When validating select items use converter on both sides

Posted by "Ondrej Svetlik (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-1730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12529871 ] 

Ondrej Svetlik commented on MYFACES-1730:
-----------------------------------------

Sorry, I forgot to mention I'm using <t:selectOneRadio layout="spread" /> but the result is the same either with different layouts or with <h:selectOneRadio />.

> When validating select items use converter on both sides
> --------------------------------------------------------
>
>                 Key: MYFACES-1730
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1730
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 1.1.5
>            Reporter: Ondrej Svetlik
>
> I'm using converters to convert enums to Strings and back and I get a validation error that "Value is not a valid option."
> in class javax.faces.component._SelectItemsUtil
> there is
>     public static boolean matchValue(Object value,
>                     Iterator selectItemsIter)
>     {
>         while (selectItemsIter.hasNext())
>         {
>             SelectItem item = (SelectItem) selectItemsIter.next();
>             if (item instanceof SelectItemGroup)
>             {
> ...
>             }
>             else
>             {
>                 Object itemValue = item.getValue();
> // here itemValue is a String but value (submited value) is already converted do my Enum<E>
>                 if (value==itemValue || value.equals(itemValue))
>                 {
>                     return true;
>                 }
>             }
>         }
>         return false;
>     }
> }
> I cannot override the Enum.equals() method because it is final.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.