Link to home
Start Free TrialLog in
Avatar of sabecs
sabecs

asked on

JavaScript - ignore error and continue page load?

Hi,
I am using http://trentrichardson.com/examples/timepicker/ in a contact form and receive the following error in IE 8.0 which stops the contact form from loading.

SCRIPT5007: Unable to set property 'parseDateTime' of undefined or null reference
File: jquery-ui-timepicker-addon.js, Line: 1125, Column: 2

	/*
	* Public Utility to parse date and time
	*/
	$.datepicker.parseDateTime = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
		var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
		if (parseRes.timeObj) {
			var t = parseRes.timeObj;
			parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
			parseRes.date.setMicroseconds(t.microsec);
		}

		return parseRes.date;
	};

Open in new window

     


Is there anyway to ignore the error and just continue with the form load without the date time picker functionality?

<script type="text/javascript">			
	
	$(document).ready(function () {

		$('#Preferred_Date_Time').datetimepicker({ 
        dateFormat: 'dd/mm/yy',
        minDate: new Date(<?php echo "$minDateY, $minDateM, $minDateD"; ?>),
        maxDate: new Date(<?php echo "$maxDateY, $maxDateM, $maxDateD"; ?>),
        showOn: "both", 
		timeFormat: 'hh:mm tt',
        buttonImage: "/images/calendar.gif", 
        buttonImageOnly: true 
      }); 
		
	});
</script>

<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.11.0/jquery-ui.min.js"></script>
<script src="/jquery_ui/development-bundle/ui/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="/ScriptLibrary/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="/ScriptLibrary/jquery.bvalidator.js"></script>
<link rel="stylesheet" href="/jquery_ui/development-bundle/themes/base/jquery.ui.all.css">

<div class="inputname">Preferred Date and Time:</div>
<div class="inputfield">
<input  name="form[Preferred_Date_Time]" type="text" class="formborder" id="Preferred_Date_Time" value="<?php echo $_SESSION['Preferred_Date_Time']; ?>" />
</div>

Open in new window

SOLUTION
Avatar of Jeffrey Dake
Jeffrey Dake
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sabecs
sabecs

ASKER

It works fine in most browsers, just need it to work or not cause an error in IE 8.0 as that is what the client is seeing?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial