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]

Reply via email to