On Tue, Dec 21, 2010 at 5:50 PM, eugenebalt <eugeneb...@yahoo.com> wrote:
> > I have a piece of Ajax code, attached to some field (let's call it > sourceField), which looks like this: > > > sourceField.add(new AjaxFormChoiceComponentUpdatingBehavior() > { > > protected void onUpdate(AjaxRequestTarget target) > { > target.addComponent(Field2); > } > } > > > As you can see, Field2 is not changed in any way, it is not cleared or > modified (so this code shouldn't really do anything). > > However, when this Ajax runs on changing the sourceField, the Field2's > values get erased! Field2 is actually a CheckBoxMultipleChoice, and all the > checkbox selections get erased as soon as I do target.addComponent(). > > Why does this happen? Any ideas on what's causing this? > Actually I have, but very unlikely: sourceField = new CheckBoxMultipleChoice("id", new MyModel(){ getObject{ return new ArrayList();} }, choiceList); this would generate your problem :-) > (Field2 is a CheckBoxMultipleChoice, initially initialized with some list, > and its outputMarkerId = true, to make it work with Ajax.) > > Thanks > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/target-addComponent-Field-in-Ajax-erases-that-Field-s-values-tp3159543p3159543.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 > > -- Pedro Henrique Oliveira dos Santos