Drop Down Menu Month Select

Help with installation and general calendar setttings

Drop Down Menu Month Select

Postby taffu » Sat May 21, 2011 12:51 pm

Hello,

I love this AJAX calendar and I find that it is extremely easy to use and well designed.

I have read the post Drop Down Menu Year Select its excellent.

My question is, how do I go about creating a DROP DOWN MENU to select the Month I want to display?

I would like to put this menu next to the Lang. selection, but I am not sure how to do that in AJAX.

Thanks
taffu
 
Posts: 4
Joined: Sat May 21, 2011 12:42 pm

Re: Drop Down Menu Month Select

Postby nightwalk » Wed Jun 20, 2012 6:59 pm

Hi,
First off, great calendar.
I am interested in the drop down moth select as well.
Any ideas?
I added this in index.php

Code: Select all
<select id="jump_month">
             <option value="1">Jan</option>
             <option value="2">Feb</option>
             <option value="3">Mar</option>
             <option value="4">Apr</option>
             <option value="5">May</option>
             <option value="6">Jun</option>
             <option value="7">Jul</option>
             <option value="8">Aug</option>
             <option value="9">Sep</option>
             <option value="10">Oct</option>
             <option value="11">Nov</option>
             <option value="12">Dec</option>
          </select>


I have this in the motools-cal-public.js file but it does not seem to work properly:

Code: Select all
$('jump_month').addEvent('change',function(){
        var  new_month=parseFloat(this.value);
        //   get each calendar and calculate new date
        $$('div.load_cal').each(function(el){
           var this_date=el.getFirst().id;
            var data=this_date.split('_');     
            //   convert to numeric
            //new_month   = parseFloat(this.value);
            cur_month   = parseFloat(data[0]);
            anew_year   = parseFloat(data[1]);
                new_month=(cur_month+months_to_show);
                if(new_month<1){
               //   reset month and add 1 year
               new_month=(new_month+12);
               new_year=(new_year-1);
            }
               if(new_month>12){
               //   reset month and add 1 year
               new_month=(new_month-12);
               anew_year=(anew_year+1);
            }
               load_calendar(el,new_month,anew_year);
           
        });
     });

every time I select a month from the drop down list it loads a calendar with the wrong months. not sure how to fix it, not a JS guru.
If there is only one month selected for displaying in the calendar, teh code is simple enough, but for more than one month, I tried the code above, along with variations of it, and the calendar is loading the wrong months, almost like the passed value for the month is not correct.
Thank you.
nightwalk
 
Posts: 1
Joined: Wed Jun 20, 2012 6:53 pm


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest