You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by vp143 <vi...@cipriati.co.uk> on 2010/09/09 18:20:12 UTC

Prepopulate time fields in DateTimeField component

Hi all,

I have a Form with the default model being a CompoundPropertyModel. I have
added the DateTimeField component to the form. I wish to prepopulate the
time fields but not the date.

I have tried a few different things but all have their various issues.

Anyone have any ideas?
Many thanks in advance.

Vishal
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Prepopulate-time-fields-in-DateTimeField-component-tp2533175p2533175.html
Sent from the Wicket - User 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: Prepopulate time fields in DateTimeField component

Posted by vp143 <vi...@cipriati.co.uk>.
Is there any way to reapply the relationship checkinDate had with the
CompoundPropertyModel?
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Prepopulate-time-fields-in-DateTimeField-component-tp2533175p2534425.html
Sent from the Wicket - User 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: Prepopulate time fields in DateTimeField component

Posted by Igor Vaynberg <ig...@gmail.com>.
Item.checkinDate=new Date()

-igor

On Thu, Sep 9, 2010 at 10:52 AM, vp143 <vi...@cipriati.co.uk> wrote:
>
> I tried that previously but then the field becomes NULL within the POJO
>
> I think this is what you mean:
>
> If i have: setDefaultModel(new CompoundPropertyModel(Item));
> where Item object contains checkinDate field
>
> I create the component: DateTimeField checkinDateField = new
> DateTimeField("checkinDate", new Model(new Date()));
>
> This populates the Date and Time fields.
> However, I do not want the Date field to be populate, and when submitting
> the Item object checkinDate is NULL. I think this is because it has lost the
> association with the CompoundPropertyModel.
>
> Many thanks
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Prepopulate-time-fields-in-DateTimeField-component-tp2533175p2533314.html
> Sent from the Wicket - User 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


Re: Prepopulate time fields in DateTimeField component

Posted by vp143 <vi...@cipriati.co.uk>.
I tried that previously but then the field becomes NULL within the POJO

I think this is what you mean:

If i have: setDefaultModel(new CompoundPropertyModel(Item));
where Item object contains checkinDate field

I create the component: DateTimeField checkinDateField = new
DateTimeField("checkinDate", new Model(new Date()));

This populates the Date and Time fields. 
However, I do not want the Date field to be populate, and when submitting
the Item object checkinDate is NULL. I think this is because it has lost the
association with the CompoundPropertyModel.

Many thanks
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Prepopulate-time-fields-in-DateTimeField-component-tp2533175p2533314.html
Sent from the Wicket - User 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: Prepopulate time fields in DateTimeField component

Posted by Igor Vaynberg <ig...@gmail.com>.
put the date value you want prepopulated into the model object

-igor

On Thu, Sep 9, 2010 at 9:20 AM, vp143 <vi...@cipriati.co.uk> wrote:
>
> Hi all,
>
> I have a Form with the default model being a CompoundPropertyModel. I have
> added the DateTimeField component to the form. I wish to prepopulate the
> time fields but not the date.
>
> I have tried a few different things but all have their various issues.
>
> Anyone have any ideas?
> Many thanks in advance.
>
> Vishal
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Prepopulate-time-fields-in-DateTimeField-component-tp2533175p2533175.html
> Sent from the Wicket - User 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