You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Linda van der Pal <lv...@heritageagenturen.nl> on 2009/07/10 12:30:08 UTC
Re: Ajaxifying FormComponentPanel
I still haven't found the solution to this problem, so I've made
quickstart for it. Since I don't think it's a bug in Wicket, I've
attached it to this message instead of creating a JIRA.
Regards,
Linda
Linda van der Pal wrote:
> 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
>> IModel<List<Subgenre>> subgenreModel = new
>> AbstractReadOnlyModel<List<Subgenre>>() {
>> @Override
>> public List<Subgenre> getObject() {
>> List<Subgenre> subgenres = new ArrayList<Subgenre>();
>> 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
>> List<DomainObject> genres = ...
>> final FieldSwitchPanel genrefield = new
>> GenreFieldSwitchPanel("genre", genres, new
>> PropertyModel<DomainObject>(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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.278 / Virus Database: 270.11.9/1991 - Release Date: 03/09/09 07:14:00
>
>