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.javabetween 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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.


Reply via email to