target.addComponent(Field) in Ajax erases that Field's values

2010-12-21 Thread eugenebalt
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

Re: target.addComponent(Field) in Ajax erases that Field's values

2010-12-21 Thread Igor Vaynberg
im going to guess that the field is repainted with the values the serverside thinks should be selected. if the values from the clientside are not processed by the serverside before the ajax update they will be different, and so the serverside state overrides the clientside state. -igor On Tue,

Re: target.addComponent(Field) in Ajax erases that Field's values

2010-12-21 Thread Jeremy Thomerson
On Tue, Dec 21, 2010 at 1: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

Re: target.addComponent(Field) in Ajax erases that Field's values

2010-12-21 Thread Hielke Hoeve
Did the field2 have an initial value or did you set the value in your browser and then let the ajax run? Hielke On 21 Dec 2010 20:51, 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:

Re: target.addComponent(Field) in Ajax erases that Field's values

2010-12-21 Thread Jeremy Thomerson
Awesome! I love the Wicket community. 11 minutes after the initial post, there are three very helpful answers. Great work everyone! On Tue, Dec 21, 2010 at 2:01 PM, Hielke Hoeve hielke.ho...@gmail.comwrote: Did the field2 have an initial value or did you set the value in your browser and

Re: target.addComponent(Field) in Ajax erases that Field's values

2010-12-21 Thread Pedro Santos
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

Re: target.addComponent(Field) in Ajax erases that Field's values

2010-12-21 Thread eugenebalt
Thanks for the fast replies, much appreciated, but what should I change in my code? I'm still not clear. Yes, the Field2 had some initial values with which it was constructed. -- View this message in context:

Re: target.addComponent(Field) in Ajax erases that Field's values

2010-12-21 Thread Igor Vaynberg
s/AjaxFormChoiceComponentUpdatingBehavior/AjaxFormSubmittingBehavior/ so all values are propagated -igor On Tue, Dec 21, 2010 at 10:24 PM, eugenebalt eugeneb...@yahoo.com wrote: Thanks for the fast replies, much appreciated, but what should I change in my code? I'm still not clear. Yes, the

Re: target.addComponent(Field) in Ajax erases that Field's values

2010-12-21 Thread eugenebalt
But I can't use AjaxFormSubmittingBehavior (correct me if I'm wrong). I need to make some changes to Field2 prior to any form submission, they have to be made as soon as the sourceField has changed in any way. I just don't want the Field2's values to get erased without me even doing anything. I

Re: target.addComponent(Field) in Ajax erases that Field's values

2010-12-21 Thread eugenebalt
It looks like I fixed it by adding new Ajax code to Field2. The Field2's Ajax code does nothing, it just calls target.addComponent() on itself: target.addComponent(Field2). This got rid of the values getting erased. So whenever you update something via Ajax, it has to be 2-way? You need to