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
