You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Matthieu Labour <ma...@strateer.com> on 2009/05/12 21:26:39 UTC
How to set a Date dynamically
Hi
I am new to Wicket. I did some research on the mailing list but didn't come
accross a solutioin for the following issue.
I need to set dynamically the Date in a DateTextField
Here
final StyleDateConverter styleDateConverter = new StyleDateConverter("S-",
true);
final IModel model = new PropertyModel(getModel(), "startDate");
final Component component = new DateTextField("startDate", model,
styleDateConverter);
final IBehavior datePicker = new DatePicker();
component.add(datePicker);
DateTime now = new DateTime();
DateTime startDate = now.minusDays(20);
and now I would like to do the following pseudo code
(DateTextField)component.setDate(startDate.toDate())
I would appreciate any help
Thank you !
Re: How to set a Date dynamically
Posted by Jeremy Thomerson <je...@wickettraining.com>.
The date is determined by your model - it's getting the date from
YourObject.getStartDate(). Set the date on YourObject and it should
work.
--
Jeremy Thomerson
http://www.wickettraining.com
On Tue, May 12, 2009 at 2:26 PM, Matthieu Labour <ma...@strateer.com> wrote:
> Hi
>
> I am new to Wicket. I did some research on the mailing list but didn't come
> accross a solutioin for the following issue.
>
> I need to set dynamically the Date in a DateTextField
>
> Here
>
> final StyleDateConverter styleDateConverter = new StyleDateConverter("S-",
> true);
> final IModel model = new PropertyModel(getModel(), "startDate");
> final Component component = new DateTextField("startDate", model,
> styleDateConverter);
> final IBehavior datePicker = new DatePicker();
> component.add(datePicker);
>
> DateTime now = new DateTime();
> DateTime startDate = now.minusDays(20);
>
> and now I would like to do the following pseudo code
> (DateTextField)component.setDate(startDate.toDate())
>
> I would appreciate any help
>
> Thank you !
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org