Re: PropertyModel not binding DropDownChoice
Lucas, Check out the EnumDropDownChoice from Wicketopia... http://wicketopia.svn.sourceforge.net/viewvc/wicketopia/trunk/wicketopia/src/main/java/org/wicketopia/component/choice/EnumDropDownChoice.java?revision=140&view=markup http://wicketopia.svn.sourceforge.net/viewvc/wicketopia/trunk/wicketopia/src/main/java/org/wicketopia/renderer/EnumChoiceRenderer.java?revision=140&view=markup On Mon, May 16, 2011 at 6:33 PM, Clint Checketts wrote: > If the ChoiceRenderer ID isn't unique or it has trouble matching it with the > selected value, you could get this problem. > > On Mon, May 16, 2011 at 2:21 PM, lucast wrote: > >> Dear Forum, >> I have yet another question about PropertyModel not binding to an object >> field but this time using DropDownChoice. >> >> In my form I have >> DropDownChoice eventOccurHowOftenDropDownChoice = new >> DropDownChoice("eventOccurHowOften", new >> PropertyModel(event, "occurrHowOften"), >> HowOftenType.getOccurHowOftenValues(), new ChoiceRendererHowOftenType() ); >> >> "occurrHowOften" is a field of object event, >> HowOftenType.getOccurHowOftenValues() return a list of Enum and >> ChoiceRendererHowOftenType simply implements getDisplayValue and getIdValue >> for IChoiceRenderer. >> >> When processing the form, after having filled the >> eventOccurHowOftenDropDownChoice, event.getOccurrHowOften returns null. >> >> As explained on >> >> http://apache-wicket.1842946.n4.nabble.com/PropertyModel-not-binding-TextField-td3527074.html >> my previous post , when analysing the content of the above >> eventOccurHowOftenDropDownChoice while debugging on Eclipse, the >> eventOccurHowOftenDropDownChoice.data contains an instance of event object >> and the occurHowOften enum field is populated. >> >> However, the original event.occurHowOften field is still null. >> Why is PropertyModel not binding the DropDownChoice to the variable? what >> am >> I missing here? >> >> >> The interesting thing is that another field DropDownChoice >> eventTypeDropDown = new DropDownChoice("eventTypeChoice",new >> PropertyModel(event, "eventType"), >> Arrays.asList(EventType.values())); >> which is binding an enum field to event object is working absolutely fine. >> The only difference between the two is that on this one I am not passing an >> IChoiceRenderer object. >> >> Even when I don't use the IChoiceRenderer instance on the former, the >> PropertyModel is still not binding the DropDownChoice value to >> event.occurHowOften variable. >> >> >> These are very simple form fields and I still don't get what I'm doing >> wrong. Can you spot where I am making some sort of mistake? >> >> Thanks in advance, >> Lucas >> >> >> -- >> View this message in context: >> http://apache-wicket.1842946.n4.nabble.com/PropertyModel-not-binding-DropDownChoice-tp3527154p3527154.html >> Sent from the Users forum mailing list archive at Nabble.com. >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: PropertyModel not binding DropDownChoice
If the ChoiceRenderer ID isn't unique or it has trouble matching it with the selected value, you could get this problem. On Mon, May 16, 2011 at 2:21 PM, lucast wrote: > Dear Forum, > I have yet another question about PropertyModel not binding to an object > field but this time using DropDownChoice. > > In my form I have > DropDownChoice eventOccurHowOftenDropDownChoice = new > DropDownChoice("eventOccurHowOften", new > PropertyModel(event, "occurrHowOften"), > HowOftenType.getOccurHowOftenValues(), new ChoiceRendererHowOftenType() ); > > "occurrHowOften" is a field of object event, > HowOftenType.getOccurHowOftenValues() return a list of Enum and > ChoiceRendererHowOftenType simply implements getDisplayValue and getIdValue > for IChoiceRenderer. > > When processing the form, after having filled the > eventOccurHowOftenDropDownChoice, event.getOccurrHowOften returns null. > > As explained on > > http://apache-wicket.1842946.n4.nabble.com/PropertyModel-not-binding-TextField-td3527074.html > my previous post , when analysing the content of the above > eventOccurHowOftenDropDownChoice while debugging on Eclipse, the > eventOccurHowOftenDropDownChoice.data contains an instance of event object > and the occurHowOften enum field is populated. > > However, the original event.occurHowOften field is still null. > Why is PropertyModel not binding the DropDownChoice to the variable? what > am > I missing here? > > > The interesting thing is that another field DropDownChoice > eventTypeDropDown = new DropDownChoice("eventTypeChoice",new > PropertyModel(event, "eventType"), > Arrays.asList(EventType.values())); > which is binding an enum field to event object is working absolutely fine. > The only difference between the two is that on this one I am not passing an > IChoiceRenderer object. > > Even when I don't use the IChoiceRenderer instance on the former, the > PropertyModel is still not binding the DropDownChoice value to > event.occurHowOften variable. > > > These are very simple form fields and I still don't get what I'm doing > wrong. Can you spot where I am making some sort of mistake? > > Thanks in advance, > Lucas > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/PropertyModel-not-binding-DropDownChoice-tp3527154p3527154.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: PropertyModel not binding DropDownChoice
Hi lucast, it would help watching source code of event's class to figure out what's wrong Dear Forum, I have yet another question about PropertyModel not binding to an object field but this time using DropDownChoice. In my form I have DropDownChoice eventOccurHowOftenDropDownChoice = new DropDownChoice("eventOccurHowOften", new PropertyModel(event, "occurrHowOften"), HowOftenType.getOccurHowOftenValues(), new ChoiceRendererHowOftenType() ); "occurrHowOften" is a field of object event, HowOftenType.getOccurHowOftenValues() return a list of Enum and ChoiceRendererHowOftenType simply implements getDisplayValue and getIdValue for IChoiceRenderer. When processing the form, after having filled the eventOccurHowOftenDropDownChoice, event.getOccurrHowOften returns null. As explained on http://apache-wicket.1842946.n4.nabble.com/PropertyModel-not-binding-TextField-td3527074.html my previous post , when analysing the content of the above eventOccurHowOftenDropDownChoice while debugging on Eclipse, the eventOccurHowOftenDropDownChoice.data contains an instance of event object and the occurHowOften enum field is populated. However, the original event.occurHowOften field is still null. Why is PropertyModel not binding the DropDownChoice to the variable? what am I missing here? The interesting thing is that another field DropDownChoice eventTypeDropDown = new DropDownChoice("eventTypeChoice",new PropertyModel(event, "eventType"), Arrays.asList(EventType.values())); which is binding an enum field to event object is working absolutely fine. The only difference between the two is that on this one I am not passing an IChoiceRenderer object. Even when I don't use the IChoiceRenderer instance on the former, the PropertyModel is still not binding the DropDownChoice value to event.occurHowOften variable. These are very simple form fields and I still don't get what I'm doing wrong. Can you spot where I am making some sort of mistake? Thanks in advance, Lucas -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/PropertyModel-not-binding-DropDownChoice-tp3527154p3527154.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
PropertyModel not binding DropDownChoice
Dear Forum, I have yet another question about PropertyModel not binding to an object field but this time using DropDownChoice. In my form I have DropDownChoice eventOccurHowOftenDropDownChoice = new DropDownChoice("eventOccurHowOften", new PropertyModel(event, "occurrHowOften"), HowOftenType.getOccurHowOftenValues(), new ChoiceRendererHowOftenType() ); "occurrHowOften" is a field of object event, HowOftenType.getOccurHowOftenValues() return a list of Enum and ChoiceRendererHowOftenType simply implements getDisplayValue and getIdValue for IChoiceRenderer. When processing the form, after having filled the eventOccurHowOftenDropDownChoice, event.getOccurrHowOften returns null. As explained on http://apache-wicket.1842946.n4.nabble.com/PropertyModel-not-binding-TextField-td3527074.html my previous post , when analysing the content of the above eventOccurHowOftenDropDownChoice while debugging on Eclipse, the eventOccurHowOftenDropDownChoice.data contains an instance of event object and the occurHowOften enum field is populated. However, the original event.occurHowOften field is still null. Why is PropertyModel not binding the DropDownChoice to the variable? what am I missing here? The interesting thing is that another field DropDownChoice eventTypeDropDown = new DropDownChoice("eventTypeChoice",new PropertyModel(event, "eventType"), Arrays.asList(EventType.values())); which is binding an enum field to event object is working absolutely fine. The only difference between the two is that on this one I am not passing an IChoiceRenderer object. Even when I don't use the IChoiceRenderer instance on the former, the PropertyModel is still not binding the DropDownChoice value to event.occurHowOften variable. These are very simple form fields and I still don't get what I'm doing wrong. Can you spot where I am making some sort of mistake? Thanks in advance, Lucas -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/PropertyModel-not-binding-DropDownChoice-tp3527154p3527154.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org