You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Igor Vaynberg <ig...@gmail.com> on 2010/04/24 18:11:15 UTC

Re: Beginner: Pre-select value on RadioChoice component using compound model

your profile object is null

-igor

On Sat, Apr 24, 2010 at 8:08 AM, Alexandros Karypidis <ak...@yahoo.gr> wrote:
> Hi,
>
> I'm using the RadioChoice component on a form with a CompoundPropertyModel.
> I'd like the form to come up witn a specific radio option selected. So I
> try:
>
>        RadioChoice<Sex> sexRadio = new RadioChoice<Sex>("profile.sex",
> Arrays
>                .asList(Sex.values()));
>        sexRadio.setChoiceRenderer(new SexChoiceRenderer());
>        sexRadio.setDefaultModelObject(Sex.FEMALE);
>
> But I get:
>
> Caused by: java.lang.IllegalStateException: Attempt to set model object on
> null model of component: profile.sex
>    at org.apache.wicket.Component.setDefaultModelObject(Component.java:3033)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org