Showing posts with label jquery. Show all posts
Showing posts with label jquery. Show all posts

Monday, January 23, 2012

Arshaw Full Calendar - Timezone fix

When we are pulling date from the server having UTC, it may display in local timezone format in Arshaw's Full Calendar. This is due to the misconfiguration in the full calendar function we are using. 

There is a constant for avoiding the timezone ie. ignoreTimezone, When parsing ISO8601 dates, whether UTC offsets should be ignored while processing event source data. The default is true, which means the UTC offset for all ISO8601 dates will be ignored. For example, the date "2008-11-05T08:15:30-05:00" will be processed as November 5th, 2008 at 8:15am in the local offset of the browser.

The below sample code shows how to use the ignoreTimezone in fullcalendar to avoid the local time constraint.

        $('#calendar').fullCalendar({
            eventSources: [
         {
                url:"json_details.php",
                ignoreTimezone: true
// For ignoring timezone
         }
           ],
            header:
            {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            editable: false,
            allDayDefault:false,
         });

Thursday, August 4, 2011

jQuery Validator Plugin - File upload validation issue : Solved

Hi folks, have you had an issue in validating file upload with jQuery Validatior Plugin.
Sample:
$("#check").validate({
        rules: {
            myfile: {required: true,
                        accept: "png|jpg|gif|jpeg"
                      },
            },
        messages: {myfile: "ERROR"    }
    });

here it checks for file having jpg,png,gif,jpeg extension and it works. But the problem is the if we make a file with name 'foo_bar.1jpg', the validator will take this as a valid file also. Here their plug-in fails....

So i have modified the plug-in code so that it will take only having valid image extension.

Just replace the accept function in the jquery.validate.js to the below code,


accept: function(value, element, param) {
            var truncate = value.split(".");
            value = truncate[1];
            param = typeof param == "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif";
            return this.optional(element) || value.match(new RegExp("^(" + param + ")$", "i"));
        },

Friday, April 22, 2011

Fix for - jQuery Error on IE 8.0 for append function.

While using append() function in jQuery, you may see some errors popping out while loading the page.
This issue usually happens in Internet Explorer 8.0 version and will work perfectly in Firefox. 
 
jQuery Function: 
append: function() {
 return this.domManip(arguments, true, function(elem){
  if (this.nodeType == 1)
        this.appendChild( elem )  });
 },
Replace the append function with the below code,
append: function() {
  return this.domManip(arguments, true, function(elem){
   if (this.nodeType == 1)
           try{this.appendChild( elem )}
           catch(err){ }
  });
 },
 
Hope this will help you ;-) 
 

Thursday, October 28, 2010

Using jQuery and MooTools Together

When using jquery and mootools together there may be an issue that one of it wont work properly.
Here is the sample code that can be used to make both work together.

<script type="text/javascript" src="jquery-1.3.js">
 
<script type="text/javascript" src="moo1.2.js">

Popular Posts