what happens if you bind the dropdown like this instead:
new DropDownChoice("roomlist", new PropertyModel(this,
"bookingModel.room"), new Model(list), renderer);
-igor
On Fri, Apr 11, 2008 at 11:47 PM, nemo_08 <[EMAIL PROTECTED]> wrote:
>
> Well ok, but I am getting other values in the same instance of BookingModel
> in onSubmit(). Here's my code
>
> private class BookingForm extends Form {
>
> private BookingModel bookingModel = new BookingModel();
>
> public BookingForm(String id, RoomModel selectedRoom) {
> super(id);
>
> // -- adding the Room list dropdown
>
> ArrayList list = new ArrayList(getRoomList());
> ChoiceRenderer renderer = new ChoiceRenderer("roomName","roomID");
> DropDownChoice roomDropDown = new DropDownChoice("roomlist", new
> PropertyModel(bookingModel,"room"), new Model(list), renderer);
> if(null!=selectedRoom)
> bookingModel.setRoom(selectedRoom);
> add(roomDropDown);
>
> add(new TextArea("purpose",new
> PropertyModel(bookingModel,"purpose")));
>
> }
>
> public final void onSubmit() {
> System.out.println("room "+bookingModel.getRoom());
> // getting 'null'
> here
> System.out.println("purpose
> "+bookingModel.getPurpose()); // getting
> value here
> }
>
> }
>
> I get value for the 'purpose' textarea. Thanks for your patience and
> replying Igor, but how else can I get the instance of BookingModel inside
> onSubmit() ? I tried getModel() - its giving null there. Is there any other
> way ?
>
>
>
>
> igor.vaynberg wrote:
> >
> > and how do you keep a reference to it? does it come from a detachable
> > model? i am guessing that the dropdownchoice does not update the same
> > instance you end up seeing null in. usually you would chain models
> > such as new propertymodel(some-wicket-imodel-you-used-to-load-the-pojo,
> > "property")
> >
> > -igor
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/DropDown-not-setting-the-object---pls-help-tp16645752p16646080.html
>
>
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]