Hi,
I tried out the DateTextField together with the Datepicker component, but it
doesn't work as expected. I want it to use the format/pattern "yyyy-MM-dd",
and when the page is rendered it does show the date in that format, but the
moment I use the datepicker (even only clicking in the button do display the
datepicker calender) the date is changed to a "yy-MM-dd" pattern, and no
matter what I do it continues to use this pattern until I refresh the page.
I have tried both the wicket-datetime version and the wicket extensions
version of the DateTextField, with no difference in behaivor. I wanted to
try the wicket-datetime version of the DatePicker but apparently it doesn't
exist any more for wicket 1.4.
Things that I have tried:
---------
// import
org.apache.wicket.datetime.markup.html.form.DateTextField;
// import org.apache.wicket.extensions.yui.calendar.DatePicker;
DateTextField dateTextField =
DateTextField.forDatePattern("dateTextField", new PropertyModel<Date>(this,
"exportDate"), "yyyy-MM-dd");
dateTextField.add(new DatePicker());
add(dateTextField);
---------
---------
// import
org.apache.wicket.extensions.markup.html.form.DateTextField;
// import org.apache.wicket.extensions.yui.calendar.DatePicker;
//
DateTextField dateTextField = new
DateTextField("dateTextField", new
PropertyModel<Date>(this, "exportDate"), "yyyy-MM-dd");
add(dateTextField);
dateTextField.add(new DatePicker());
---------
---------
// import
org.apache.wicket.datetime.markup.html.form.DateTextField;
// import org.apache.wicket.extensions.yui.calendar.DatePicker;
//
DateTextField dateTextField = new
DateTextField("dateTextField", new
PropertyModel<Date>(
this, "exportDate"), new StyleDateConverter("S-", true))
{
@Override
public Locale getLocale()
{
return new Locale("sv", "SE");
}
};
add(dateTextField);
dateTextField.add(new DatePicker());
---------
That last example is almost a copy paste of the example code from here:
http://wicketstuff.org/wicket/dates/
...with the difference that my locale is hard coded. The example on
wicketstuff works just fine when I select the same locale.
The html is simply a input field like this:
---------
<input type="text" wicket:id="dateTextField"/>
---------
Does anyone have any explanation to this strange behavior? What can I do to
get it to always use "yyyy-MM-dd2"? This is very hard for me to debug since
it is client side (ie javascript) behavior, not server side java behavior.
Regards
/Jimi
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Javascript-string-formatting-problem-with-DateTextField-and-DatePicker-tp2241433p2241433.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]