Per,
a temporary fix for now would be to instead of adding the DateTextField to
the AjaxRequestTarget,
add text.getParent()
i'll fix this "misbehavior" with something similar what matej did with the
IndicatingAjaxButton
Gerolf
On 10/4/07, Per Newgro <[EMAIL PROTECTED]> wrote:
>
> Hi *,
>
> I present a date by 3 DropDownChoices (year, month, day). Additionally i
> want to provide a datepicker. The sync from datepicker selection to
> dropdownchoises is working as expected. On the other hand if i change the
> dropdownchoise the datepicker value will be changed, but it is represented
> by a second icon (Or third one if i click again ...). How can i avoid that
> the datepicker gets a further icon after ajax update.
>
> Cheers
> Per
>
> Here the code fragments
>
> final DropDownChoice year =
> WicketComponentFactory.getNotifyDropDownChoice("year",
> model, "_year", model.getAvailableYears());
>
> final DateTextField text = new DateTextField("textDate", new
> PropertyModel(model, "date"));
>
> final DatePicker dp = new DatePicker();
> dp.bind(year);
> text.add(dp);
>
> form.add(year);
> form.add(text);
>
> year.setOutputMarkupId(true);
> year.add(new AjaxFormComponentUpdatingBehavior("onchange") {
> private static final long serialVersionUID = 8454408934269214172L;
>
> protected void onUpdate(AjaxRequestTarget target) {
> IPreSelectionModel m = (IPreSelectionModel) getModelObject();
> m.makeValidFromdate();
> target.addComponent(text);
> }
> });
>
> text.setOutputMarkupId(true);
> text.add(new AjaxFormComponentUpdatingBehavior("onchange") {
> private static final long serialVersionUID = -7951690038251173325L;
>
> protected void onUpdate(AjaxRequestTarget target) {
> IPreSelectionModel m = (IPreSelectionModel) getModelObject();
> m.setDay(m.getDate());
> m.setMonth(m.getDate());
> m.setYear(m.getDate());
> m.makeValidFromdate();
> target.addComponent(day);
> target.addComponent(month);
> target.addComponent(year);
> }
> });
>
> add(form);
>
> --
> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>