I am working on an old project for maintenance. I found that document.all
is not working in Firefox 25. And I am getting the error below.
TypeError: document.all.TabularDataControlAttivitta.object is undefined
And my sample code is:
document.all.TabularDataControlProj.object.Filter = 'COMPANYCODE=' + pValue;
document.all.TabularDataControlProj.object.Reset();
document.getElementById('cmbActivity_' + rowNo).options.length = 1;
if (document.getElementById('cmbProject_' + rowNo).options.length > 0) {
for (var i = document.getElementById('cmbProject_' + rowNo).options.length - 1; i >= 0; i--) {
document.getElementById('cmbProject_'+rowNo).options[i] = null;
}
}
if (document.all.TabularDataControlProj.recordset.recordcount > 0) {
document.all.TabularDataControlProj.recordset.movefirst;
}
pOption = new Option('-Select-', -1);
document.getElementById('cmbProject_' + rowNo).add(pOption);
while (document.all.TabularDataControlProj.recordset.eof == false) {
Optionp = new Option((document.all.TabularDataControlProj.recordset.fields(0) + ' - ' + document.all.TabularDataControlProj.recordset.fields(2)), document.all.TabularDataControlProj.recordset.fields(0));
document.getElementById('cmbProject_' + rowNo).add(Optionp);
document.getElementById('cmbProject_' + rowNo).selectedIndex = indxAct;
document.all.TabularDataControlProj.recordset.movenext;
}
}
Any patch or solution for this? Because it's very difficult to edit the entire project.
I am working on an old project for maintenance. I found that document.all
is not working in Firefox 25. And I am getting the error below.
TypeError: document.all.TabularDataControlAttivitta.object is undefined
And my sample code is:
document.all.TabularDataControlProj.object.Filter = 'COMPANYCODE=' + pValue;
document.all.TabularDataControlProj.object.Reset();
document.getElementById('cmbActivity_' + rowNo).options.length = 1;
if (document.getElementById('cmbProject_' + rowNo).options.length > 0) {
for (var i = document.getElementById('cmbProject_' + rowNo).options.length - 1; i >= 0; i--) {
document.getElementById('cmbProject_'+rowNo).options[i] = null;
}
}
if (document.all.TabularDataControlProj.recordset.recordcount > 0) {
document.all.TabularDataControlProj.recordset.movefirst;
}
pOption = new Option('-Select-', -1);
document.getElementById('cmbProject_' + rowNo).add(pOption);
while (document.all.TabularDataControlProj.recordset.eof == false) {
Optionp = new Option((document.all.TabularDataControlProj.recordset.fields(0) + ' - ' + document.all.TabularDataControlProj.recordset.fields(2)), document.all.TabularDataControlProj.recordset.fields(0));
document.getElementById('cmbProject_' + rowNo).add(Optionp);
document.getElementById('cmbProject_' + rowNo).selectedIndex = indxAct;
document.all.TabularDataControlProj.recordset.movenext;
}
}
Any patch or solution for this? Because it's very difficult to edit the entire project.
Share edited Nov 20, 2016 at 5:54 Peter Mortensen 31.6k22 gold badges110 silver badges133 bronze badges asked Jan 2, 2014 at 9:58 user1703145user1703145 1751 gold badge4 silver badges13 bronze badges3 Answers
Reset to default 4document.all
is non-standard. It was a Microsoft-specific feature that they added to IE. Most other browsers have never supported it.
Even in IE it is now deprecated. You should not be using it.
(your old project must be very old, because this has been the case for quite some time now)
For most cases, you can use document.getElementById()
instead.
If you're using document.all
to get an element using it's ID value then document.getElementById()
is a direct replacement.
If you're using document.all
to get an element some other way, then I remend switching to getting it by ID (add an ID if necessary).
I note that the way you're using the element makes it look like it may be an activeX control? (ie I see stuff like .object.Filter
, .recordset.movefirst
, etc)
If that is the case, then you need to be aware that Firefox does not support activeX controls at all. They are also specific to IE. If it is an activeX control and you need it to work in Firefox then unfortunately, you probably have quite a lot of rewriting ahead of you.
Document.all
Provides access to all elements with an id. This a legacy non-standard interface, you should use the document.getElementById()
method instead.
Ref: https://developer.mozilla/en/docs/Web/API/Document
As the error states, the problem is not with document.all
not working (it does), it's with document.all.TabularDataControlAttivitta.object
being undefined. This could be either because of application-specific reasons (you simply don't define an object
expando), or because you have several elements with name or id equal to TabularDataControlAttivitta.