WordPress.org

Forums

MailChimp List Subscribe Form
JS code from MailChimp causes error in IE (EASY fix below, please fix plugin!) (1 post)

  1. raspberryh
    Member
    Posted 2 years ago #

    Hi,

    I am getting an error in IE7 (could be other versions too):

    A Runtime Error has occurred. Do you wish to Debug?
    Line: 79
    Error: Expected identifier, string or number

    This is caused from the following JS code that's injected into the header:

    jQuery(function($) {
    			$('.date-pick').datepicker({
    				autoFocusNextInput: true,
    				constrainInput: false,
    				changeMonth: true,
    				changeYear: true,
    				beforeShow: function(input, inst) { $('#ui-datepicker-div').addClass('show'); },
    				dateFormat: 'yy/mm/dd',
    			});			
    
    			d = new Date();
    			$('.birthdate-pick').datepicker({
    				autoFocusNextInput: true,
    				constrainInput: false,
    				changeMonth: true,
    				changeYear: false,
    				minDate: new Date(d.getFullYear(), 1-1, 1),
    				maxDate: new Date(d.getFullYear(), 12-1, 31),
    				beforeShow: function(input, inst) { $('#ui-datepicker-div').removeClass('show'); },
    				dateFormat: 'mm/dd',
    			});
    
    		});

    It's a REALLY simple solution - just remove the last comma at the end of each list (IE doesn't like those extra commas). So the correct code would be:

    jQuery(function($) {
    			$('.date-pick').datepicker({
    				autoFocusNextInput: true,
    				constrainInput: false,
    				changeMonth: true,
    				changeYear: true,
    				beforeShow: function(input, inst) { $('#ui-datepicker-div').addClass('show'); },
    				dateFormat: 'yy/mm/dd'
    			});			
    
    			d = new Date();
    			$('.birthdate-pick').datepicker({
    				autoFocusNextInput: true,
    				constrainInput: false,
    				changeMonth: true,
    				changeYear: false,
    				minDate: new Date(d.getFullYear(), 1-1, 1),
    				maxDate: new Date(d.getFullYear(), 12-1, 31),
    				beforeShow: function(input, inst) { $('#ui-datepicker-div').removeClass('show'); },
    				dateFormat: 'mm/dd'
    			});
    
    		});

    This should be changed in mailchimp.php lines 139 and 151.

    If I change these myself, then I will not be able to get updates from future versions! So can the MailChimp folks please change this on their side?

    Thanks!
    Heather

    http://wordpress.org/extend/plugins/mailchimp/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • MailChimp List Subscribe Form
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic