You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by vinbr88 <vi...@googlemail.com> on 2012/05/29 17:01:53 UTC

Display last date in Tomahawk input calendar (t:inputCalendar)

Hello,

I am using the t:inputCalendar in my application and it works fine.
When I click on the calendar symbol, the current date is selected every
time. So if I want to change the date by one day, I have to browse to the
corresponding day and year of the last date, which is very annoying.
Because every time the current day is selected.

Is there a possibility to popup the calendar with the last selected date
and not with the date of today?

Thank you in advance.

Vince

Re: Display last date in Tomahawk input calendar (t:inputCalendar)

Posted by neutrin0 <vi...@googlemail.com>.
Hi,

thx for your reply and sorry for the long time passed. I had to work on
other things.

I will explain my problem a little better.
I have no problems accessing the value from the backing bean. When the page
is loaded, the value of the backing bean is 
loaded perfectly in the textfield of the popup calendar. When I change the
date value and send it to my backing bean, the
value will be stored in the bean like it should.

But when I click on the calendar symbol and the calendar pops up, then
todays date is shown in the calendar popup. I expect
that the calendar navigates to the date in the input field of the popup
calendar.

Other example:
When I click on the calendar symbol the calendar pops up. July is selected
and todays date is marked. Now I select the date December, 15. The date
appears in the input field of the tomahawk calendar. That's ok. At this time
the form was not sent to the backing bean, because save button was not
clicked. Now the user decides to change the date to December, 16 before he
saves the data. When the user clicks on the popup symbol, the calendar comes
up. But the displayed month is July again, and the
marked day, is today again. I expect that the calendar navigates to
December, 15 as it was selected before, so the user does not have to
navigate again to December.

How can I fix that?

Thank you again!




teisentraeger@googlemail.com wrote:
> 
> Dear Vince,
> 
> The calendar should not show the current day, but the day which is
> currently saved in the backing value. I suspect that you are
> initializing the value in the backing bean with the current day.
> 
> So if you declare your calendar as following:
> <t:inputCalendar value="#{TestBean.inOneYear}" />
> 
> It will show the date which is set in the backing bean.
> The following example will initialize the calendar with the current
> date, but the year set to 2013.
> 
> public Date inOneYear;
> 
> //Constructor
> public TestBean()  {
>        Calendar nowCal = new GregorianCalendar();
>        nowCal.set(Calendar.YEAR, 2013);
>        inOneYear = nowCal.getTime();
> }
> 
> // getter
>    public Date getInOneYear() {
> return inOneYear;
> }
> 
> // setter
>    public void setInOneYear(Date pInOneYear) {
> inOneYear = pInOneYear;
> }
> 
> The calendar on your page should show this:
> 
> < Mai 2013 >
> Mo Di Mi Do Fr Sa So
>   1 2 3 4 5
> 6 7 8 9 10 11 12
> 13 14 15 16 17 18 19
> 20 21 22 23 24 25 26
> 27 28 29 30 31
> 
> If you change the month and save the date and then navigate back to
> this page later it should open the calendar on the new month, provided
> that the backing bean is in session scope.
> 
> 
> Tobias Eisentraeger
> 
> 
> On Tue, May 29, 2012 at 5:01 PM, vinbr88 <vi...@googlemail.com> wrote:
>>
>> Hello,
>>
>> I am using the t:inputCalendar in my application and it works fine.
>> When I click on the calendar symbol, the current date is selected every
>> time. So if I want to change the date by one day, I have to browse to the
>> corresponding day and year of the last date, which is very annoying.
>> Because every time the current day is selected.
>>
>> Is there a possibility to popup the calendar with the last selected date
>> and not with the date of today?
>>
>> Thank you in advance.
>>
>> Vince
> 
> 

-- 
View this message in context: http://old.nabble.com/Display-last-date-in-Tomahawk-input-calendar-%28t%3AinputCalendar%29-tp33925641p34151469.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Display last date in Tomahawk input calendar (t:inputCalendar)

Posted by Tobias Eisentrager <te...@googlemail.com>.
Dear Vince,

The calendar should not show the current day, but the day which is
currently saved in the backing value. I suspect that you are
initializing the value in the backing bean with the current day.

So if you declare your calendar as following:
<t:inputCalendar value="#{TestBean.inOneYear}" />

It will show the date which is set in the backing bean.
The following example will initialize the calendar with the current
date, but the year set to 2013.

public Date inOneYear;

//Constructor
public TestBean()  {
       Calendar nowCal = new GregorianCalendar();
       nowCal.set(Calendar.YEAR, 2013);
       inOneYear = nowCal.getTime();
}

// getter
   public Date getInOneYear() {
return inOneYear;
}

// setter
   public void setInOneYear(Date pInOneYear) {
inOneYear = pInOneYear;
}

The calendar on your page should show this:

< Mai 2013 >
Mo Di Mi Do Fr Sa So
  1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

If you change the month and save the date and then navigate back to
this page later it should open the calendar on the new month, provided
that the backing bean is in session scope.


Tobias Eisentraeger


On Tue, May 29, 2012 at 5:01 PM, vinbr88 <vi...@googlemail.com> wrote:
>
> Hello,
>
> I am using the t:inputCalendar in my application and it works fine.
> When I click on the calendar symbol, the current date is selected every
> time. So if I want to change the date by one day, I have to browse to the
> corresponding day and year of the last date, which is very annoying.
> Because every time the current day is selected.
>
> Is there a possibility to popup the calendar with the last selected date
> and not with the date of today?
>
> Thank you in advance.
>
> Vince