CalendarXP.net Support Forum Index CalendarXP.net Support
Most forums here are private and invisible to public.
 
 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Track buttons on page "<" and ">" without opening the popup.

 
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> PopCalendarXP Related
View previous topic :: View next topic  
Author Message
gunnar



Joined: 25 Oct 2005
Posts: 6

PostPosted: Wed Oct 26, 2005 4:03 pm    Post subject: Track buttons on page "<" and ">" without opening the popup. Reply with quote

In addition to the PopCalendar I would like to add track buttons on the page. When you push the "<" the date should be changed to the previous month (in the format YYYY-MM) without showing the popup. The buttons should work similarto the ones on the popup but they should not display the popup and should change the "input" object right away and submit the form.

The idea here is to give the user the ability to traverse to the previous month with just one mouse click.
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Wed Oct 26, 2005 6:39 pm    Post subject: Reply with quote

The following code should do the job:
Code:
<form name="testForm">
<input name="testfield">
<input type="button" value="<" onclick="prev(document.testForm.testfield)">
<input type="button" value=">" onclick="next(document.testForm.testfield)">
</form>
<script>
function parseMonth(f) {
   var dt=f.value.match(/^(\d{4})-([0]?[1-9]|1[0-2])$/);
   if (dt==null) {
      var d=new Date();
      return [d.getFullYear(), d.getMonth()+1];
   }
   return [parseInt(dt[1],10), parseInt(dt[2],10)];
}
function prev(f) {
   var mth=parseMonth(f);
   mth[1]--;
   if (mth[1]<1) {mth[0]--; mth[1]=12}
   f.value=mth[0]+"-"+padZero(mth[1]);
}
function next(f) {
   var mth=parseMonth(f);
   mth[1]++;
   if (mth[1]>12) {mth[0]++; mth[1]=1}
   f.value=mth[0]+"-"+padZero(mth[1]);
}
function padZero(n) {
   return n<10?"0"+n:n;
}
</script>

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
gunnar



Joined: 25 Oct 2005
Posts: 6

PostPosted: Thu Oct 27, 2005 9:35 am    Post subject: Reply with quote

Would it be possible to have the steps depend on what has been chosen (month, date, week). To have it depend on the format of the string ?

Month: Letīs say October 2005 has been chosen and the string is "2005-01" would it be possible to have "<" change the string to "2004-12" and ">" change the string to "2005-02".

Date: Letīs say "2005-10-09" has been chosen, would it be possible to have "<" change the string to "2005-10-08" and ">" change the string to "2005-10-10"

Week: Letīs say week 42 of 2005 has been chosen and the string is "2005-10-17 2005-10-23" would it be possible to have "<" change the string to "2005-10-10 2005-10-16" and ">" change the string to "2005-10-24 2005-10-30"
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Fri Oct 28, 2005 12:05 am    Post subject: Reply with quote

Sorry, but that's not supported.
_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> PopCalendarXP Related All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Copyright 2003- Idemfactor Solutions, Inc. All rights reserved.
Powered by phpBB © 2001, 2005 phpBB Group