myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Safurudin Mahic <safu...@stud.aitel.hist.no>
Subject Re: Validation error with selectitems in latest Myfaces/Tomahawk
Date Wed, 27 Jun 2007 10:14:38 GMT
Ok - I tried to implement the solution -

<h:selectOneMenu id="statusid"
                                value="#{testBean.statusid}">
                                <f:selectItem itemValue="#{0}" 
itemLabel="Ikke paabegynt" />
                                <f:selectItem itemValue="#{1}" 
itemLabel="Under arbeid" />
                                <f:selectItem itemValue="#{2}" 
itemLabel="Kansellert" />
                                <f:selectItem itemValue="#{3}" 
itemLabel="Utfort" />
                                <f:convertNumber integerOnly="true"/>
                            </h:selectOneMenu>

however, I still got the validation error when I didn't use the explicit 
f:convertNumber.
I'm guessing the #{0} etc are integer valueexpressions, hence returning 
the correct type to the value of
the selectonemenu. Wouldn't the expected behavior be that it works 
without the explicit converter?

-safi


Cagatay Civici skrev:
> Hi,
>
> Sounds like;
>
> http://wiki.apache.org/myfaces/Tomahawk_1%2e1%2e4_to_1%2e1%2e5
>
> Cagatay
>
> On 6/27/07, *Safurudin Mahic* <safurum@stud.aitel.hist.no 
> <mailto:safurum@stud.aitel.hist.no>> wrote:
>
>     I'm having problems getting a correct form submittal with a simple
>     selectOneMenu in the latest MyFaces and TomaHawk.
>
>     After issuing the command button, I'm getting "Validation Error
>     "statusid": Value is not a valid option."
>     The statusid is an Integer value on the backing bean.
>     In previous versions (1.1.1) this works fine. Doesn't MyFaces/Tomahawk
>     in later versions autoconvert strings to integers where appropriate?
>
>     My form looks like this:
>
>     <?xml version="1.0" encoding="UTF-8"?>
>     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>     " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
>     <html xmlns="http://www.w3.org/1999/xhtml"
>         xmlns:ui=" http://java.sun.com/jsf/facelets"
>         xmlns:h="http://java.sun.com/jsf/html"
>         xmlns:f="http://java.sun.com/jsf/core
>     <http://java.sun.com/jsf/core>"
>         xmlns:t="http://myfaces.apache.org/tomahawk"
>         xmlns:acegijsf="http://sourceforge.net/projects/jsf-comp/acegijsf
>     <http://sourceforge.net/projects/jsf-comp/acegijsf>"
>         xml:lang="en" lang="en">
>
>     <body>
>         <f:view>
>             <h:form>
>             <h:messages globalOnly="false" showDetail="true"
>     showSummary="true"/>
>             <h:selectOneMenu id="statusid"
>                                             value="#{testBean.statusid}"
>                                             styleClass="inputfield_long">
>                                             <f:selectItem itemValue="0"
>                                                 itemLabel="Test1" />
>                                             <f:selectItem itemValue="1"
>     itemLabel="Test2" />
>                                             <f:selectItem itemValue="2"
>     itemLabel="Test3" />
>                                             <f:selectItem itemValue="3"
>                                                 itemLabel="Test4" />
>                                         </h:selectOneMenu>
>
>
>             <h:commandButton />
>             <h:outputText value="#{ testBean.statusid}"></h:outputText>
>             </h:form>
>         </f:view>
>     </body>
>     </html>
>
>
>
>
>
>
>
>
>


Mime
View raw message