Jump to content
  • 0

Calendar Navigation


spearheading

Question

Hi

I've created a booking system, which uses a calendar datapage as the main interactive element for taking the bookings. A few of my clients, who use the system daily, have asked if there is a quicker way of navigating from month to month views, without having to click the 'next' key several times.

Is it possible to have a 'mini-calendar' view displayed, with 6 months or 1yr view ahead, so that you can click on the actual date that you want to go to on the main calendar view?

Any thoughts would be appreciated.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi,

There is custom JS solution for this.

Insert following code in the footer of the results page (example for monthly calendar):

<input type="text" id="opendate" onkeyup="if(event.keyCode==13)opendate();" />
<input type="button" value="Jump to date" onclick="opendate()"/>

<script type="text/javascript">
function opendate(){
 var vDate = document.getElementById("opendate").value;
 var mDate = new Date(vDate);
 if(!mDate)return;
var startDateString = "cbCalendarStartDate=" + mDate.getDate() + "/" + (mDate.getMonth() + 1) + '/' + mDate.getFullYear();

if(document.location.href.indexOf("cbCalendarStartDate") != -1) {
    document.location.href = document.location.href.replace(/cbCalendarStartDate=[0-9\/]+/ig, startDateString);
} else {
    var separator = document.location.href.indexOf('?') != -1 ? '&' : '?';
    document.location.href = document.location.href + separator + startDateString;
}
}
</script>

Hope this helps.

Link to comment
Share on other sites

  • 0

Thanks ShWolf,

This has been really helpful but, for some reason, I am getting inconsistent results when I use the 'Jump To' box. It jumps to the required date five or six times in a row and then stays on the current view. Do I need to change anything within the JS or could I be doing something else wrong? If it can work 100%, it's a perfect solution for my problem!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...