Took a while but I've finally figured this one out - after a couple of days
searching with google.

The Lists are filled from the database using Value Objects created with
XDoclet. The validator is going back to the database to retrieve the Object
per the ID given. The 2 objects from the List and the one retrieved from the
DB don't compare as equals (for whatever reason that is).

When I traverse the list from the component parameter it actually works as
it should.

It might be a good idea to put that information up into the WIKI section
somewhere about validation and converters. Making sure that the object
returned by the Converter actually must pass equal to the value that is
existing in the list. That can save people several days of searching.

I have no idea why the objects are not equal since on the test system I'm
the only user and they objects don't change in the database. Must be
something that XDoclet is doing strange.

Thanks for all the help,
Reiner

-----Original Message-----
From: Reiner K. Kappenberger [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 20, 2005 9:10 AM
To: 'MyFaces Development'
Subject: RE: Validation Errors for selectItems in SelectOneMenu


Mathias,

the Lists are never empty. The way it's set up is that if a list is empty
than the selection isn't taken and the original one is maintained.

What I've observed is that from time to time a selection is possible
(yikes). Especially when none of the select boxes is changed the selections
are accepted. However changing one of the selections is causing the issue.

Reiner

-----Original Message-----
From: Mathias Brökelmann [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 20, 2005 1:25 AM
To: MyFaces Development
Subject: Re: Validation Errors for selectItems in SelectOneMenu


make sure that myBean.field2List and myBean.field3List never returns an
empty collection. This is required during processValidation.

If that will not fix it please post your bean code.

2005/12/19, Reiner K. Kappenberger <[EMAIL PROTECTED]>:
> Simon,
>
> No Javascript is used. All modifications to the Lists are done in the
> valueChangeListener components. I prefer to leave the JavaScript part 
> to MyFaces components - that's what they are really good for.
>
> The other part is a typo - since I took out the realy long Bean names
> from the original code.
>
> The strange thing is that if I don't change any of the select boxes it
> works. Select one of them and it doesn't pass through the validation 
> phase. What I don't understand is that the first drop down box never 
> receives a validation error. It's always the fields for the second and 
> third ones.
>
> Reiner
>
> -----Original Message-----
> From: Simon Kitching [mailto:[EMAIL PROTECTED]
> Sent: Sunday, December 18, 2005 9:17 PM
> To: MyFaces Development
> Subject: Re: Validation Errors for selectItems in SelectOneMenu
>
>
> Hi Reiner,
>
> I believe that a select component requires that when the picked value
> is not null, it must be one of the values in the associated options.
>
> You're not using javascript to change the value of the 2nd and 3rd
> menus into something that isn't in their associated options are you?
>
> Also: is this a typo (meyBean vs myBean)?
>    <f:selectItems value="#{meyBean.field2List}" />
>
> Cheers,
>
> Simon
>
> Reiner K. Kappenberger wrote:
> > Hi folks,
> >
> > I'm fighting a peculiar problem right now on a Web page with 3
> > selectOneMenu items. The first 2 of those are for allowing the user 
> > to narrow down the 3rd drop down box (to prevent overly large drop 
> > down lists). When using valueChangeListeners the drop down boxes are 
> > populated just fine.
> >
> > The problem arrises when submitting the form for storage. I'm
> > getting "Value is not a valid option" on the last 2 drop down lists. 
> > The second one isn't even associated with any storage (since all I 
> > care about is the value change event).
> >
> > To illustrate here's the snipet from the page:
> >
> >
> > <h:outputLabel for="field1Input">
> >     #{resources['fiel1Label']}
> > </h:outputLabel>
> > <h:selectOneMenu id="field1Input"
> >                  valueChangeListener="#{myBean.changeField1Listener}"
> >                  onchange="submit()"
> >                  converter="field1Converter" >
> >     <f:selectItems value="#{myBean.field1List}" />
> > </h:selectOneMenu> <h:message for="field1Input" 
> > styleClass="errors"/>
> >
> >
> > <!-- Select Model for Device -->
> > <h:outputLabel for="field2Input">
> >     #{resources['field2Label']}
> > </h:outputLabel>
> > <h:selectOneMenu id="field2Input"
> >                  valueChangeListener="#{myBean.changeField2Listener}"
> >                  onchange="submit()"
> >                  converter="field2Converter" >
> >     <f:selectItems value="#{meyBean.field2List}" />
> > </h:selectOneMenu> <h:message for="field2Input" 
> > styleClass="errors"/>
> >
> > <!-- Select SNR for Device -->
> >
> > <h:outputLabel for="field3Input">
> >     #{resources['field3Label']}
> > </h:outputLabel>
> > <h:selectOneMenu id="field3Input"
> >                  converter="field3Converter"
> >                  value="#{myBean.selectValue}" >
> >     <f:selectItems value="#{myBean.field3List}"/> </h:selectOneMenu>
> > <h:message for="field3Input" styleClass="errors" />
> >
> > myBean contains the Listeners (that will do the DB query and fill
> > the value lists (ArrayList) for the drop down boxes. The whole thing 
> > is running within Facelets if that makes a difference. As well I've 
> > downloaded the nightly build from 12/17/05 to make sure it wasn't 
> > already fixed. It looked a bit like the MYFACES-996 bug, but I'm not 
> > sure.
> >
> > Thank you for any help or suggestions,
> > Reiner
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Free Edition.
> > Version: 7.1.371 / Virus Database: 267.14.1/206 - Release Date:
> > 12/16/2005
> >
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.371 / Virus Database: 267.14.1/206 - Release Date:
> 12/16/2005
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.371 / Virus Database: 267.14.1/206 - Release Date:
> 12/16/2005
>
>
>


--
Mathias

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.1/207 - Release Date: 12/19/2005
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.1/207 - Release Date: 12/19/2005
 

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.1/207 - Release Date: 12/19/2005
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.2/208 - Release Date: 12/20/2005
 

Reply via email to