Updates on model of FormComponents not being displayed after Ajax call
Hello everyone, in an AjaxFormComponentUpdatingBehavior callback I make some changes to the object which is the target of the CompundPropertyModel of a form. After the changes are made, I add the FormComponents (RequiredTextFields) that are mapped to the changed properties of the model object to the AjaxRequestTarget. If I log the property values to the console, I can see that have the expected (changed) values. Unfortunately, the FormComponents do not show the updates after the Ajax call returns. Interestingly, the form validation uses the expected/changed values after the click on a submit button, even though the FormComponents still show the wrong (unchanged) values. Is there something besides the adding of the respective components to the AjaxRequestTarget that I am missing here? Any help highly appreciated, Jonas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Updates on model of FormComponents not being displayed after Ajax call
Hi Jonas, you need to notify those form components about their model value change. e.g. formComponent.modelChanged(); target.add(formComponent); 2011/8/31 Jonas Pohlandt jonas.pohla...@lbi.com Hello everyone, in an AjaxFormComponentUpdatingBehavior callback I make some changes to the object which is the target of the CompundPropertyModel of a form. After the changes are made, I add the FormComponents (RequiredTextFields) that are mapped to the changed properties of the model object to the AjaxRequestTarget. If I log the property values to the console, I can see that have the expected (changed) values. Unfortunately, the FormComponents do not show the updates after the Ajax call returns. Interestingly, the form validation uses the expected/changed values after the click on a submit button, even though the FormComponents still show the wrong (unchanged) values. Is there something besides the adding of the respective components to the AjaxRequestTarget that I am missing here? Any help highly appreciated, Jonas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos
AW: Updates on model of FormComponents not being displayed after Ajax call
Hi Pedro, just tried that. Unfortunately it did not work. I checked the source: public final void modelChanged() { // Call user code internalOnModelChanged(); onModelChanged(); } Both internalOnModelChanged and onModelChanged are empty in their default implementation by Component (which is not overwritten by RequiredTextField or any of its superclasses). Jonas -Ursprüngliche Nachricht- Von: Pedro Santos [mailto:pedros...@gmail.com] Gesendet: Mittwoch, 31. August 2011 16:12 An: users@wicket.apache.org Betreff: Re: Updates on model of FormComponents not being displayed after Ajax call Hi Jonas, you need to notify those form components about their model value change. e.g. formComponent.modelChanged(); target.add(formComponent); 2011/8/31 Jonas Pohlandt jonas.pohla...@lbi.com Hello everyone, in an AjaxFormComponentUpdatingBehavior callback I make some changes to the object which is the target of the CompundPropertyModel of a form. After the changes are made, I add the FormComponents (RequiredTextFields) that are mapped to the changed properties of the model object to the AjaxRequestTarget. If I log the property values to the console, I can see that have the expected (changed) values. Unfortunately, the FormComponents do not show the updates after the Ajax call returns. Interestingly, the form validation uses the expected/changed values after the click on a submit button, even though the FormComponents still show the wrong (unchanged) values. Is there something besides the adding of the respective components to the AjaxRequestTarget that I am missing here? Any help highly appreciated, Jonas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Updates on model of FormComponents not being displayed after Ajax call
FormComponent overrides internalOnModelChanged. I guess the problem is the raw input cache in the form component. Since you changed the model value, you also needs to make sure that this user input cache will be discarded. Try FormComponent#clearInput before add it in the target. 2011/8/31 Jonas Pohlandt jonas.pohla...@lbi.com Hi Pedro, just tried that. Unfortunately it did not work. I checked the source: public final void modelChanged() { // Call user code internalOnModelChanged(); onModelChanged(); } Both internalOnModelChanged and onModelChanged are empty in their default implementation by Component (which is not overwritten by RequiredTextField or any of its superclasses). Jonas -Ursprüngliche Nachricht- Von: Pedro Santos [mailto:pedros...@gmail.com] Gesendet: Mittwoch, 31. August 2011 16:12 An: users@wicket.apache.org Betreff: Re: Updates on model of FormComponents not being displayed after Ajax call Hi Jonas, you need to notify those form components about their model value change. e.g. formComponent.modelChanged(); target.add(formComponent); 2011/8/31 Jonas Pohlandt jonas.pohla...@lbi.com Hello everyone, in an AjaxFormComponentUpdatingBehavior callback I make some changes to the object which is the target of the CompundPropertyModel of a form. After the changes are made, I add the FormComponents (RequiredTextFields) that are mapped to the changed properties of the model object to the AjaxRequestTarget. If I log the property values to the console, I can see that have the expected (changed) values. Unfortunately, the FormComponents do not show the updates after the Ajax call returns. Interestingly, the form validation uses the expected/changed values after the click on a submit button, even though the FormComponents still show the wrong (unchanged) values. Is there something besides the adding of the respective components to the AjaxRequestTarget that I am missing here? Any help highly appreciated, Jonas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos