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 <lucastol...@hotmail.com> 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<HowOftenType> eventOccurHowOftenDropDownChoice = new
> DropDownChoice<HowOftenType>("eventOccurHowOften", new
> PropertyModel<HowOftenType>(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<EventType>
> eventTypeDropDown = new DropDownChoice<EventType>("eventTypeChoice",new
> PropertyModel<EventType>(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
>
>

Reply via email to