Hi, Should be better with a form
private IModel<Date> date; public Test() { super(); add(new TestForm("form", date = new Model<Date>(new Date()))); } private class TestForm extends Form { public TestForm(String form, final IModel<Date> dateModel) { super(form, dateModel); DateField txtDate = new DateField("txtDate", dateModel) { @Override protected DateTextField newDateTextField(java.lang.String id, PropertyModel dateFieldModel) { DateTextField dateTextField = super.newDateTextField(id, dateFieldModel); AjaxFormComponentUpdatingBehavior ajaxFormComponentUpdatingBehavior = new AjaxFormComponentUpdatingBehavior("onChange") { @Override protected void onUpdate(AjaxRequestTarget target) { System.out.println("dateModel :[" + dateModel + "]"); } }; dateTextField.add(ajaxFormComponentUpdatingBehavior); return dateTextField; } }; add( txtDate ); } } François Le 12 avr. 2012 à 13:35, dpmihai a écrit : > I created a simple page with a DateField and an > AjaxFormComponentUpdatingBehavior where I want to read the model. The > following code does work in Wicket 1.4.16 (prints the selected date), but > does not in Wicket 1.5.5 (prints null): > > public class DatePage extends WebPage { > > private Date date; > > public DatePage() { > super(); > > final DateField txtDate = new DateField("txtDate", new > PropertyModel(this, > "date")) { > @Override > protected DateTextField > newDateTextField(java.lang.String id, > PropertyModel dateFieldModel) { > DateTextField f = super.newDateTextField(id, > dateFieldModel); > f.add(createAjaxBehavior()); > return f; > } > }; > add(txtDate); > } > > private AjaxFormComponentUpdatingBehavior createAjaxBehavior() { > return new AjaxFormComponentUpdatingBehavior("onchange") { > @Override > protected void onUpdate(AjaxRequestTarget target) { > System.out.println("*** date=" + date); > } > > }; > } > > } > > Does anyone know something about this? > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/DateField-and-AjaxFormComponentUpdatingBehavior-in-wicket-1-5-5-tp4551607p4551607.html > Sent from the Users forum 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 > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org