I have and onchange function set up on a field on my Lead CRM 2011 form. Everything works correctly on IE9, but after upgrading to IE11 I get an onchange event error.
Unable to get property 'length' of undefined or null reference
Here is my code:
function leadsourcecode_onchange() {
//LeadSourceCode OnChange --winner
//"Right" function
function Right(str, n) {
if (n <= 0)
return "";
else if (n > String(str).length)
return str;
else {
var iLen = String(str).length;
return String(str).substring(iLen, iLen - n);
}
}
var oLeadsourcecode = crmForm.all.leadsourcecode;
var oSecondaryLeadsourcecode = crmForm.all.new_secondaryleadsource;
var oFilter = null;
var currentselectedvalue = oSecondaryLeadsourcecode.DataValue;
oSecondaryLeadsourcecode.Disabled = false;
// Get Sub-Category Filter
oFilter = Right(oLeadsourcecode.SelectedText, 2);
var iIndex = 0;
var text1 = null;
// Set the picklist back to the original value
oSecondaryLeadsourcecode.Options = oSecondaryLeadsourcecode.originalPicklistOptions;
// Create a new array, which will hold the new picklist options
var oTempArray = new Array();
// Initialize the index for the temp array
var iIndex = 0;
var iNewIndex = 0;
for (var i = 0; i < oSecondaryLeadsourcecode.originalPicklistOptions.length; i++) {
oSecondaryLeadsourcecode.DataValue = i;
text1 = oSecondaryLeadsourcecode.children[i].innerHTML;
if (i == 0) {
oSecondaryLeadsourcecode.DataValue = 0;
// Found the required field
oSecondaryLeadsourcecode.AddOption(text1, 0);
iNewIndex = oSecondaryLeadsourcecode.selectedIndex;
oTempArray[iIndex] = oSecondaryLeadsourcecode.originalPicklistOptions[0];
iIndex++;
}
// Search for filter in text1
if (text1.indexOf(oFilter) != -1) {
oSecondaryLeadsourcecode.DataValue = i;
// Found the required field
oSecondaryLeadsourcecode.AddOption(text1, i);
iNewIndex = oSecondaryLeadsourcecode.children[i].index;
oTempArray[iIndex] = oSecondaryLeadsourcecode.originalPicklistOptions[iNewIndex];
iIndex++;
}
}
// Reset the Sub-Industry picklist with the new options
oSecondaryLeadsourcecode.Options = oTempArray;
}
When I turn on debugging in IE11 it shows a DOM7011 error. "The code on this page disabled back and forward caching. For more information, see: go.microsoft.com/fwlink"
Thanks for any assistance,
-Brian






