I saw that the resolution for this
bug(https://issues.apache.org/jira/browse/WICKET-4496) is "Not a problem"
using getDefaultModelObject().
But it remains a question. If I have a DatetimeField and I want an
AjaxFormComponentUpdatingBehavior so that if I click the button, or if I
change the hours or minutes field, to see the model of my current date, I
was done like this in wicket 1.4 (and in wicket 1.5 date is null):
private Date date;
final DateTimeField txtDate = new DateTimeField("txtDate", new
PropertyModel(this, "date")) {
@Override
protected DateTextField
newDateTextField(java.lang.String id,
PropertyModel dateFieldModel) {
final DateTextField f =
super.newDateTextField(id, dateFieldModel);
f.add(new
AjaxFormComponentUpdatingBehavior("onchange") {
@Override
protected void
onUpdate(AjaxRequestTarget target) {
System.out.println("*** date="
+ f.getDefaultModelObject());
}
});
return f;
}
};
final Component HOUR = txtDate.get("hours");
HOUR.add(new AjaxFormComponentUpdatingBehavior("onchange") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
System.out.println("*** hours=" +
HOUR.getDefaultModelObject()); // ok
as sugested
System.out.println("*** date=" + date); //
null in wicket 1.5
}
});
final Component MINUTES = txtDate.get("minutes");
MINUTES.add(new AjaxFormComponentUpdatingBehavior("onchange") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
System.out.println("*** minutes=" +
MINUTES.getDefaultModelObject()); //
ok as sugested
System.out.println("*** date=" + date); //
null in wicket 1.5
}
});
add(txtDate);
Using getDefaultModelObject() I can get hours and minutes field. But how to
get the entire date? Do you have any sugestions?
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/DateField-and-AjaxFormComponentUpdatingBehavior-in-wicket-1-5-5-tp4551607p4566846.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]