SamJolly
asked on
Object 'is undefined'.... intermittent error...need a clue please.....
Hi All,
I use a great little Javascript Calendar component called JSCalendar. We have this running with 100s of users without a problem. On three machines we have encountered
'Calendar is undefined' which is really strange.
The first occurrence was with a desktop running IE5, and when updated to IE6 the issue went away.
We now have 2 laptops with the same problem, different site. These laptops are running IE6.0.29 on Windows 2000, patched to date, and apparently have the same config as all the desktops in the same company which all work fine... what????
So for the code.
In the <head> section I reference the Calendar code files.
<link href="../../../Js/Other/JS Calendar/c alendar-th eme.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../../Js/Other/JSC alendar/ca lendar.js" ></script>
<script type="text/javascript" src="../../../Js/Other/JSC alendar/la ng/calenda r-en.js">< /script>
<script type="text/javascript" src="../../../Js/Other/JSC alendar/ca lendar-set up.js"></s cript>
In the body I have a textbox with an arrow image to the right of it which when clicked brings up the calendar. When you click on the calendar on the relevant date, the value goes into the textbox. The calendar is a CSS layer so no need for a popup.
This is the calling code in the <body>
<div id="FromDateValue">
<input id="tbFromDate" name="FromDate" style="width:157px;height: 19px" type="text" class="REM_FormTextboxGo" value="01/01/2004" size="16" maxlength="20" onBlur="blnIsDirty=true;"/ >
</div>
<div id="FromDateGo">
<a id="HlImgFromDateGo" href="#">
<img id="ImgFromDateGo" onClick="blnIsDirty=true;" src="../../../img/ddlb.gif " alt="Click Here to Pick up the date" border="0"/>
</a>
<script type="text/javascript">
Calendar.setup({
inputField : "tbFromDate", // id of the input field
ifFormat : "%d/%m/%Y", // format of the input field
daFormat : "%d/%m/%Y", // format of the input field
button : "HlImgFromDateGo", // trigger for the calendar (button ID)
align : "Bl", // alignment (defaults to "Bl")
singleClick : true
});
</script>
</div>
I appreciate that you may be unfamiliar with this component, but I thought someone may have an idea of why this intermittent JS error would occur, expecially when 98% of the users are fine, so nothing intrinsically wrong with the app.
Any ideas would be hugely appreciated,
Sam
I use a great little Javascript Calendar component called JSCalendar. We have this running with 100s of users without a problem. On three machines we have encountered
'Calendar is undefined' which is really strange.
The first occurrence was with a desktop running IE5, and when updated to IE6 the issue went away.
We now have 2 laptops with the same problem, different site. These laptops are running IE6.0.29 on Windows 2000, patched to date, and apparently have the same config as all the desktops in the same company which all work fine... what????
So for the code.
In the <head> section I reference the Calendar code files.
<link href="../../../Js/Other/JS
<script type="text/javascript" src="../../../Js/Other/JSC
<script type="text/javascript" src="../../../Js/Other/JSC
<script type="text/javascript" src="../../../Js/Other/JSC
In the body I have a textbox with an arrow image to the right of it which when clicked brings up the calendar. When you click on the calendar on the relevant date, the value goes into the textbox. The calendar is a CSS layer so no need for a popup.
This is the calling code in the <body>
<div id="FromDateValue">
<input id="tbFromDate" name="FromDate" style="width:157px;height:
</div>
<div id="FromDateGo">
<a id="HlImgFromDateGo" href="#">
<img id="ImgFromDateGo" onClick="blnIsDirty=true;"
</a>
<script type="text/javascript">
Calendar.setup({
inputField : "tbFromDate", // id of the input field
ifFormat : "%d/%m/%Y", // format of the input field
daFormat : "%d/%m/%Y", // format of the input field
button : "HlImgFromDateGo", // trigger for the calendar (button ID)
align : "Bl", // alignment (defaults to "Bl")
singleClick : true
});
</script>
</div>
I appreciate that you may be unfamiliar with this component, but I thought someone may have an idea of why this intermittent JS error would occur, expecially when 98% of the users are fine, so nothing intrinsically wrong with the app.
Any ideas would be hugely appreciated,
Sam
Is the script for Calendar.setup javascript?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes it is,
There is a fair amount of code. I include some useful parts of it.
It starts like this:
Calendar.setup = function (params) {
function param_default(pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } };
param_default("inputField" , null);
param_default("displayArea ", null);
param_default("button", null);
param_default("eventName", "click");
param_default("ifFormat", "%Y/%m/%d");
param_default("daFormat", "%Y/%m/%d");
param_default("singleClick ", true);
param_default("disableFunc ", null);
param_default("dateStatusF unc", params["disableFunc"]); // takes precedence if both are defined
param_default("mondayFirst ", true);
param_default("align", "Bl");
param_default("range", [1900, 2999]);
param_default("weekNumbers ", true);
param_default("flat", null);
param_default("flatCallbac k", null);
param_default("onSelect", null);
param_default("onClose", null);
param_default("onUpdate", null);
param_default("date", null);
param_default("showsTime", false);
param_default("timeFormat" , "24");
and laterly there seems to be some instantiation:
var triggerEl = params.button || params.displayArea || params.inputField;
triggerEl["on" + params.eventName] = function() {
var dateEl = params.inputField || params.displayArea;
var dateFmt = params.inputField ? params.ifFormat : params.daFormat;
var mustCreate = false;
var cal = window.calendar;
if (!window.calendar) {
window.calendar = cal = new Calendar(params.mondayFirs t,
params.date,
params.onSelect || onSelect,
params.onClose || function(cal) { cal.hide(); });
cal.showsTime = params.showsTime;
cal.time24 = (params.timeFormat == "24");
cal.weekNumbers = params.weekNumbers;
mustCreate = true;
} else {
cal.hide();
}
cal.setRange(params.range[ 0], params.range[1]);
cal.params = params;
cal.setDateStatusHandler(p arams.date StatusFunc );
cal.setDateFormat(dateFmt) ;
if (mustCreate)
cal.create();
cal.parseDate(dateEl.value || dateEl.innerHTML);
cal.refresh();
cal.showAtElement(params.d isplayArea || params.inputField, params.align);
return false;
};
I hope this helps.
really apreciate your input,
Sam
There is a fair amount of code. I include some useful parts of it.
It starts like this:
Calendar.setup = function (params) {
function param_default(pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } };
param_default("inputField"
param_default("displayArea
param_default("button", null);
param_default("eventName",
param_default("ifFormat", "%Y/%m/%d");
param_default("daFormat", "%Y/%m/%d");
param_default("singleClick
param_default("disableFunc
param_default("dateStatusF
param_default("mondayFirst
param_default("align", "Bl");
param_default("range", [1900, 2999]);
param_default("weekNumbers
param_default("flat", null);
param_default("flatCallbac
param_default("onSelect", null);
param_default("onClose", null);
param_default("onUpdate", null);
param_default("date", null);
param_default("showsTime",
param_default("timeFormat"
and laterly there seems to be some instantiation:
var triggerEl = params.button || params.displayArea || params.inputField;
triggerEl["on" + params.eventName] = function() {
var dateEl = params.inputField || params.displayArea;
var dateFmt = params.inputField ? params.ifFormat : params.daFormat;
var mustCreate = false;
var cal = window.calendar;
if (!window.calendar) {
window.calendar = cal = new Calendar(params.mondayFirs
params.date,
params.onSelect || onSelect,
params.onClose || function(cal) { cal.hide(); });
cal.showsTime = params.showsTime;
cal.time24 = (params.timeFormat == "24");
cal.weekNumbers = params.weekNumbers;
mustCreate = true;
} else {
cal.hide();
}
cal.setRange(params.range[
cal.params = params;
cal.setDateStatusHandler(p
cal.setDateFormat(dateFmt)
if (mustCreate)
cal.create();
cal.parseDate(dateEl.value
cal.refresh();
cal.showAtElement(params.d
return false;
};
I hope this helps.
really apreciate your input,
Sam
ASKER
Searlas,
Just read your comments. Very interesting...
>>One question: does this 'Calendar is undefined' error occur everytime these few users load the page, or just the 1st time? If it's everytime, it's likely the users concerned aren't allowing their browsers to cache anything.
Yes, it happens all the time. How can I reproduce this non caching behaviour - is there an IE setting that I can change?
I will comme bck to the onLoad solution after I have checked the Caching..
Thanks,
Sam
Just read your comments. Very interesting...
>>One question: does this 'Calendar is undefined' error occur everytime these few users load the page, or just the 1st time? If it's everytime, it's likely the users concerned aren't allowing their browsers to cache anything.
Yes, it happens all the time. How can I reproduce this non caching behaviour - is there an IE setting that I can change?
I will comme bck to the onLoad solution after I have checked the Caching..
Thanks,
Sam
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am closing this now, as I think we have a lead on the solution.
Thanks to all,
Sam
Thanks to all,
Sam