myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wolf Benz <euroj...@gmail.com>
Subject Re: [Solved] ERROR: Value is not a valid option
Date Thu, 14 Feb 2008 19:38:02 GMT
You can also use tr:selectOneChoice instead of h:selectOneMenu
With the same t:selectItems inside, h:... gives me errors; tr:... not  
at all!
-Wolf

On 27 Feb 2007, at 10:31, CarlHowarth wrote:

>
> Thanks very much Mike - all I needed to do to get this to work is  
> change the
> itemvalue of my t:selectitems from:
>
> "#{r.idString}"
>
> to:
>
> "#{r}"
>
> Thanks again - Carl
>
>
>
> Mike Kienenberger wrote:
>>
>> Yes, that's how I would do it.  If you specify an itemValue, then  
>> that
>> value must be of the correct type.  Ie, " " is not a containerType
>> (Srinivas) and "0" is not a region (Carl).
>>
>> On 2/26/07, Kevin Galligan <kgalligan@gmail.com> wrote:
>>> I am using facelets.  Where would that function go?  Each  
>>> f:selectItem
>>> entry?
>>>
>>> <f:selectItem itemLabel="Website URL"
>>> itemValue="#{myfn:convertStringToShort(3)}"/>
>>>
>>>
>>>
>>>
>>> On 2/26/07, Mike Kienenberger <mkienenb@gmail.com> wrote:
>>>> Take a look at
>>> http://issues.apache.org/jira/browse/MYFACES-1328.   It
>>>> looks like the RI does not have this convenience conversion.   I  
>>>> don't
>>>> know what the spec says, but that'd be the place to get a  
>>>> definitive
>>>> answer.
>>>>
>>>> If you're using facelets, as a temporary workaround you could  
>>>> create a
>>>> "convertStringToShort()" function (or whatever conversion you're
>>>> expecting to have happen automatically).
>>>>
>>>>
>>>> On 2/26/07, Kevin Galligan <kgalligan@gmail.com> wrote:
>>>>> I did try that and didn't have any luck.  I think that was due  
>>>>> to the
>>> fact
>>>>> that I was using shorts rather than ints, but I'd have to try it
>>> again
>>> now
>>>>> that I have a better understanding of everything involved.
>>>>>
>>>>> I looked at TOMAHAWK-152 briefly.  I'll have to sit down and  
>>>>> take a
>>> better
>>>>> look at it.  It looks to be in the realm.  The string value of  
>>>>> 'true'
>>> not
>>>>> matching with a boolean type value?
>>>>>
>>>>> I guess the bottom line is I'd like to find out if I should be  
>>>>> using
>>> an
>>>>> explicit converter to go from String to Short, or if the JSF api
>>> being
>>> used
>>>>> should be able to handle a simple[r] conversion like that.  It was
>>> doing
>>>>> that conversion originally.  Does the JSF spec cover this?   
>>>>> Anybody
>>> happen
>>>>> to know what the reference implementation does?  I'd love to try  
>>>>> it
>>> out,
>>> but
>>>>> we're trying to push this out the door, so for the near future I  
>>>>> have
>>> to
>>>>> focus on what's right in front of me.
>>>>>
>>>>>
>>>>> On 2/26/07, Martin Grotzke < martin.grotzke@javakaffee.de> wrote:
>>>>>> Does it work when you use itemValue="#{3}" as workaround?
>>>>>>
>>>>>> I also had the same problem with itemValue="true", what I think 

>>>>>> is
>>>>>> http://issues.apache.org/jira/browse/TOMAHAWK-152 ...
>>>>>>
>>>>>> Cheers,
>>>>>> Martin
>>>>>>
>>>>>>
>>>>>> On Mon, 2007-02-26 at 11:23 -0500, Kevin Galligan wrote:
>>>>>>> I'm having the same problem.  I had some code that was working
>>> for a
>>>>>>> long time with 1.1.5-SNAPSHOT, and now I'm getting that error.
>>>>>>>
>>>>>>> <h:selectOneMenu
>>>>> value="#{shared$FavoriteDocumentAdd.documentTypeId}"
>>>>>>> onchange="toggleInputRow()" id="documentTypeSelect"
>>>>>>> style="background-color:rgb(204,204,255)">
>>>>>>>   <f:selectItem itemLabel="Website URL" itemValue="3"/>
>>>>>>>   <f:selectItem itemLabel="File Upload" itemValue="1"/>
>>>>>>>   <f:selectItem itemLabel="Description Only" itemValue="2"/>
>>>>>>> </h:selectOneMenu>
>>>>>>>
>>>>>>> The value being set is a short.  Essentially it looks like the
>>> code
>>>>>>> was doing an automatic conversion before, but now chokes.
>>>>>>>
>>>>>>> I just reverted the code to 1.1.5-SNAPSHOT, and it works again.
>>> I'm
>>>>>>> going to try to take a quick look at the differences between
>>>>>>> UISelectOne.java between those two versions, but in practice
 
>>>>>>> I've
>>>>>>> found with any large code base, it'll take a little time to
>>> really
>>>>>>> understand the layout.
>>>>>>>
>>>>>>> On 2/26/07, CarlHowarth < carl.howarth@dlapiper.com> wrote:
>>>>>>>
>>>>>>>       Hi,
>>>>>>>
>>>>>>>       I am having this problem too. My select one is set up as
>>>>>>>       follows:
>>>>>>>
>>>>>>>       <h:selectOneMenu id="regionList"
>>>>>>>       binding="#{Bean.regionListUI}"
>>>>>>>       value="#{ Bean.region}" >
>>>>>>>         <f:converter converterId=" myapp.Region"/>
>>>>>>>         <f:selectItem itemValue="0" itemLabel="(all)"/>
>>>>>>>         <t:selectItems var="r" itemLabel="#{ r.name }"
>>>>>>>       itemValue="#{ r.idString}"
>>>>>>>       value="#{applicationBean.regionMap}" />
>>>>>>>         <f:attribute name="fieldRef" value="Region List"/>
>>>>>>>       </h:selectOneMenu>
>>>>>>>
>>>>>>>       - This was working fine with 1.1.4 but since the upgrade
>>> to
>>>>>>>       1.1.5 it now
>>>>>>>       falls over.
>>>>>>>       - The application bean is at application scope, so the
>>> values
>>>>>>>       should always
>>>>>>>       be available.
>>>>>>>       - The converter changes an ID to a region and vice versa.
>>>>>>>       - The page loads up fine, I only have the problem when
I
>>>>>>>       select a command
>>>>>>>       button that runs an action listener.
>>>>>>>       - I use a '<t:saveState value="#{Bean_track}"/>'
for my
>>>>>>>       request-scoped bean.
>>>>>>>       - The region bean implements a working 'equals' method.
>>>>>>>       - If I select the manually populated select item, (all),
>>> it
>>>>>>>       works correctly.
>>>>>>>
>>>>>>>       My converter is like this:
>>>>>>>
>>>>>>>       public final static String CONVERTER_ID = "
>>> myapp.Region";
>>>>>>>           public Object getAsObject(FacesContext facesContext,
>>>>>>>       UIComponent
>>>>>>>       uiComponent, String string)
>>>>>>>                   throws ConverterException {
>>>>>>>
>>>>>>>              return
>>>>>>>
>>>>>
>>> JSFUtils 
>>> .getAppBackingBean().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();
>>>>>>>           }
>>>>>>>
>>>>>>>
>>>>>>>       I am at a complete loss at the moment, so any thoughts
on
>>> what
>>>>>>>       could be
>>>>>>>       causing this error would be appreciated.
>>>>>>>
>>>>>>>       Thanks, Carl
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>       Ernst Fastl wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I have had a similar problem recently. Generally
>>> happens
>>> if
>>>>>>>       the
>>>>>>>> application is not able to find the selected value in
>>> the
>>>>>>>       List of
>>>>>>>> selectItems.
>>>>>>>> This can be due to 2 possible situations:
>>>>>>>>
>>>>>>>> 1. The list is not available during validation
>>>>>>>> -> try using a <t:saveState
>>>>>>>       value="#{reportsBean.containerTypeList }" />
>>>>>>>> to ensure it is
>>>>>>>>
>>>>>>>> 2. The values of the selectItems (getValue() and
>>> setValue())
>>>>>>>       do not
>>>>>>>> contain
>>>>>>>> Strings and there is no converter:
>>>>>>>>
>>>>>>>> -> use a corresponding converter e.g. for Long -
>>>>>>>       LongConverter
>>>>>>>> for the selectOneMenu
>>>>>>>>
>>>>>>>> hope that helps
>>>>>>>>
>>>>>>>> regards
>>>>>>>>
>>>>>>>> Ernst
>>>>>>>>
>>>>>>>> On 2/22/07, Srinivas V <vuyyuru.srinivas@gmail.com >
>>> wrote:
>>>>>>>>> Hi All,
>>>>>>>>> Please help me!!
>>>>>>>>> I am having an issue with SelectOneMenu.
>>>>>>>>>
>>>>>>>>> I have installed JSF 1.1.5-SNAPSHOT ,Tomahawk1.1.5-
>>> SNAPSHOT
>>>>>>>       and
>>>>>>>>> tomahawk-sandbox-1.1.5-SNAPSHOT.
>>>>>>>>>
>>>>>>>>> Previously i had myfaces1.1 jar
>>>>>>>>> I dint have issue with selectOneMenu before.
>>>>>>>>>
>>>>>>>>> Now when I submit the page, I am getting this jsf
>>>>>>>       validation error:
>>>>>>>>> Container:"Value is not a valid option"
>>>>>>>>> for a selectOneMenu even if i select some option.
>>>>>>>>>
>>>>>>>>> code:
>>>>>>>>> <h:panelGroup
>>>>>>>       rendered="#{reportsBean.renderContainerType}">
>>>>>>>>>  <x:outputLabel for="containerfilter"
>>>>>>>>> value="#{msgBundle.EPCMgr_ContainerLbl }:"
>>>>>>>>> styleClass="standard_text_bold"/>
>>>>>>>>>  <f:verbatim><br/></f:verbatim>
>>>>>>>>>  <h:selectOneMenu id="containerfilter"
>>>>>>>>> value="#{ reportsBean.containerType}" immediate="true"
>>>>>>>       disabled="#{
>>>>>>>>> reportsBean.optionDisabled }"
>>> styleClass="standard_input">
>>>>>>>>>   <f:selectItem itemValue="" itemLabel=" " />
>>>>>>>>>   <f:selectItems
>>>>>>>       value="#{reportsBean.containerTypeList }"/>
>>>>>>>>>  </h:selectOneMenu>
>>>>>>>>> </h:panelGroup>
>>>>>>>>>
>>>>>>>>> Can anybody tell me why it is happening?
>>>>>>>>>
>>>>>>>>> regards
>>>>>>>>> srinivas
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>       --
>>>>>>>       View this message in context:
>>> http://www.nabble.com/ERROR%
>>>>>>>
>>>>> 3A-Value-is-not-a-valid-option-tf3270984.html#a9155607
>>>>>>>       Sent from the MyFaces - Users mailing list archive at
>>>>>>>       Nabble.com.
>>>>>>>
>>>>>>>
>>>>>> --
>>>>>> Martin Grotzke
>>>>>> http://www.javakaffee.de/blog/
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/ERROR%3A-Value-is-not-a-valid-option-tf3270984.html#a9178333
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>


Mime
View raw message