You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by lucast <lu...@hotmail.com> on 2013/12/18 16:40:13 UTC

Extending TextField to display Joda's LocalTime in HH:mm format

Dear Forum,
I am trying to have an input field in which user inserts a time of the day
in HH:mm format.
In some cases, the field could be already populated.

I thought of extending TextField<LocalTime> and pass a LocalTime object to
the form field.

The problem is that when if the local time variable already has a value, the
LocalTime field will be populated in HH:mm:ss.SSS format.

How can I properly extend TextField so that when populating the field it
will do it in *HH:mm* format, please?

I would be grateful if someone could point me in the right direction?

I am trying to extend text field but I don't know which function I should
override.


My simple example is as follow:
HomePage class:



HomePage HTML:

And the maven import for joda time:


Thanks in advance,
Lucas



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Extending-TextField-to-display-Joda-s-LocalTime-in-HH-mm-format-tp4663112.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Extending TextField to display Joda's LocalTime in HH:mm format

Posted by lucast <lu...@hotmail.com>.
Thank you, Sven.
I am pleasantly surprised to see how clear and easy to follow the
documentation was and more importantly, how clean and straightforward the
implementation of converters can be.

Regards,
Lucas



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Extending-TextField-to-display-Joda-s-LocalTime-in-HH-mm-format-tp4663112p4663175.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Extending TextField to display Joda's LocalTime in HH:mm format

Posted by Sven Meier <sv...@meiers.net>.
Use a converter:

http://wicket.apache.org/guide/guide/chapter11.html#chapter11_3

Regards
Sven

On 12/18/2013 04:40 PM, lucast wrote:
> Dear Forum,
> I am trying to have an input field in which user inserts a time of the day
> in HH:mm format.
> In some cases, the field could be already populated.
>
> I thought of extending TextField<LocalTime> and pass a LocalTime object to
> the form field.
>
> The problem is that when if the local time variable already has a value, the
> LocalTime field will be populated in HH:mm:ss.SSS format.
>
> How can I properly extend TextField so that when populating the field it
> will do it in *HH:mm* format, please?
>
> I would be grateful if someone could point me in the right direction?
>
> I am trying to extend text field but I don't know which function I should
> override.
>
>
> My simple example is as follow:
> HomePage class:
>
>
>
> HomePage HTML:
>
> And the maven import for joda time:
>
>
> Thanks in advance,
> Lucas
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Extending-TextField-to-display-Joda-s-LocalTime-in-HH-mm-format-tp4663112.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org