Re: Ajaxifying FormComponentPanel
When I debug the app, I can see that getObject() is being called for subgenrefield, only selectedGenre == null. I also put a breakpoint in convertInput() inside the GenreFieldSwithPanel, but it doesn't pass it. Shouldn't it use that to determine what the new value of the model will be? Linda Linda van der Pal wrote: That is in fact the type of behavior I am using. Here's a bit of the code: // The subgenre-field IModelListSubgenre subgenreModel = new AbstractReadOnlyModelListSubgenre() { @Override public ListSubgenre getObject() { ListSubgenre subgenres = new ArrayListSubgenre(); if (selectedGenre != null){ // Fetch the subgenres based on selectedGenre subgenres = ... } return subgenres; } }; final FieldSwitchPanel subgenrefield = new SubgenreFieldSwitchPanel(subgenre, subgenreModel); subgenrefield.setOutputMarkupId(true); subgenrefield.setOutputMarkupPlaceholderTag(true); form.add(subgenrefield); // The genre-field // fetch the genres ListDomainObject genres = ... final FieldSwitchPanel genrefield = new GenreFieldSwitchPanel(genre, genres, new PropertyModelDomainObject(this, selectedGenre)); genrefield.add(new AjaxFormComponentUpdatingBehavior(onchange) { @Override protected void onUpdate(AjaxRequestTarget target) { target.addComponent(subgenrefield); } }); genrefield.setOutputMarkupPlaceholderTag(true); form.add(genrefield); The problem is that selectedGenre stays null. So I'm looking for the cause of that. My guess is that it is because the model isn't updated. (I did implement convertInput() in GenreFieldSwitchPanel, which extends FormComponentPanel.) Linda jWeekend wrote: Linda, Take a look at AjaxFormComponentUpdatingBehavior. Regards - Cemal http://jWeekend.com jWeekend Linda van der Pal wrote: I have a FormComponentPanel that contains a TextField and a DropDownChoice. Of those two only one is visible at any moment. (The TextField is there for when the DropDownChoice doesn't offer the wanted result.) On the panel that contains the FormComponentPanel, I want another element to respond to any change in the FormComponentPanel (most importantly if the user selects something from the DropDownChoice). I have added ajax behavior to the component, but the model isn't updated, so when I debug the onChange method of the behavior, I find that the object in the model is null. How do I get it to update properly? Regards, Linda van der Pal - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Ajaxifying FormComponentPanel
I have a FormComponentPanel that contains a TextField and a DropDownChoice. Of those two only one is visible at any moment. (The TextField is there for when the DropDownChoice doesn't offer the wanted result.) On the panel that contains the FormComponentPanel, I want another element to respond to any change in the FormComponentPanel (most importantly if the user selects something from the DropDownChoice). I have added ajax behavior to the component, but the model isn't updated, so when I debug the onChange method of the behavior, I find that the object in the model is null. How do I get it to update properly? Regards, Linda van der Pal - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Ajaxifying FormComponentPanel
Linda, Take a look at AjaxFormComponentUpdatingBehavior. Regards - Cemal http://jWeekend.com jWeekend Linda van der Pal wrote: I have a FormComponentPanel that contains a TextField and a DropDownChoice. Of those two only one is visible at any moment. (The TextField is there for when the DropDownChoice doesn't offer the wanted result.) On the panel that contains the FormComponentPanel, I want another element to respond to any change in the FormComponentPanel (most importantly if the user selects something from the DropDownChoice). I have added ajax behavior to the component, but the model isn't updated, so when I debug the onChange method of the behavior, I find that the object in the model is null. How do I get it to update properly? Regards, Linda van der Pal - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://www.nabble.com/Ajaxifying-FormComponentPanel-tp22371617p22372521.html Sent from the Wicket - User 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
Re: Ajaxifying FormComponentPanel
That is in fact the type of behavior I am using. Here's a bit of the code: // The subgenre-field IModelListSubgenre subgenreModel = new AbstractReadOnlyModelListSubgenre() { @Override public ListSubgenre getObject() { ListSubgenre subgenres = new ArrayListSubgenre(); if (selectedGenre != null){ // Fetch the subgenres based on selectedGenre subgenres = ... } return subgenres; } }; final FieldSwitchPanel subgenrefield = new SubgenreFieldSwitchPanel(subgenre, subgenreModel); subgenrefield.setOutputMarkupId(true); subgenrefield.setOutputMarkupPlaceholderTag(true); form.add(subgenrefield); // The genre-field // fetch the genres ListDomainObject genres = ... final FieldSwitchPanel genrefield = new GenreFieldSwitchPanel(genre, genres, new PropertyModelDomainObject(this, selectedGenre)); genrefield.add(new AjaxFormComponentUpdatingBehavior(onchange) { @Override protected void onUpdate(AjaxRequestTarget target) { target.addComponent(subgenrefield); } }); genrefield.setOutputMarkupPlaceholderTag(true); form.add(genrefield); The problem is that selectedGenre stays null. So I'm looking for the cause of that. My guess is that it is because the model isn't updated. (I did implement convertInput() in GenreFieldSwitchPanel, which extends FormComponentPanel.) Linda jWeekend wrote: Linda, Take a look at AjaxFormComponentUpdatingBehavior. Regards - Cemal http://jWeekend.com jWeekend Linda van der Pal wrote: I have a FormComponentPanel that contains a TextField and a DropDownChoice. Of those two only one is visible at any moment. (The TextField is there for when the DropDownChoice doesn't offer the wanted result.) On the panel that contains the FormComponentPanel, I want another element to respond to any change in the FormComponentPanel (most importantly if the user selects something from the DropDownChoice). I have added ajax behavior to the component, but the model isn't updated, so when I debug the onChange method of the behavior, I find that the object in the model is null. How do I get it to update properly? Regards, Linda van der Pal - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.278 / Virus Database: 270.11.8/1986 - Release Date: 03/05/09 19:32:00