D
Doug Lerner
I have this snippet of client side code running:
var makeField = document.forms[0][makeFieldName];
alert("makeFieldName name,length,type=" + makeFieldName + ", " +
makeField.name + "," + makeField.length + "," + makeField.type);
The alert is just in there for debugging.
The function containing this code is called when a select field option is
changed. makeFieldName is the name of the select field in the form.
It works correctly from:
OS X / Safari
OS X / IE
OS X / Firefox
Windows / Firefox
but doesn't work right in Windows / IE6.
The diagnostic alert that shows up from all the browsers except Windows /
IE6 is the same:
makeFieldName name,length,type=1_onlyCarMake, 1_onlyCarMake,63,select-one
In other words, the makeFieldName is correct (1_onlyCarMake), and is the
same as makeField.name. The correct field is found and it has the right
number of options and the correct type for a select field.
But in Windows / IE6 only the diagnostic alert shows up with:
makeFieldName name,length,type=1_onlyCarMake, startWith,undefined,hidden
The startWith field happens to be the first field in that form (the only
form in the document, by the way) and it is, in fact, a hidden field. Thus
it makes sense that the length shown is undefined, since it is not a select
field and thus has no options array.
The problem is - why is Windows /IE6 incorrectly returning that field as a
result of the expression "document.forms[0][makeFieldName]" when all the
other browsers are returning the correct field?
It doesn't make any different whether I use document.forms[0][makeFieldName]
or actually specify the name of the form, as in
document["thisFormName"][makeFieldName]. In either case it works everywhere
but in Windows / IE6.
Anybody have any idea why the client is confused and returning the first
form element rather than the named one?
Thanks!
doug
var makeField = document.forms[0][makeFieldName];
alert("makeFieldName name,length,type=" + makeFieldName + ", " +
makeField.name + "," + makeField.length + "," + makeField.type);
The alert is just in there for debugging.
The function containing this code is called when a select field option is
changed. makeFieldName is the name of the select field in the form.
It works correctly from:
OS X / Safari
OS X / IE
OS X / Firefox
Windows / Firefox
but doesn't work right in Windows / IE6.
The diagnostic alert that shows up from all the browsers except Windows /
IE6 is the same:
makeFieldName name,length,type=1_onlyCarMake, 1_onlyCarMake,63,select-one
In other words, the makeFieldName is correct (1_onlyCarMake), and is the
same as makeField.name. The correct field is found and it has the right
number of options and the correct type for a select field.
But in Windows / IE6 only the diagnostic alert shows up with:
makeFieldName name,length,type=1_onlyCarMake, startWith,undefined,hidden
The startWith field happens to be the first field in that form (the only
form in the document, by the way) and it is, in fact, a hidden field. Thus
it makes sense that the length shown is undefined, since it is not a select
field and thus has no options array.
The problem is - why is Windows /IE6 incorrectly returning that field as a
result of the expression "document.forms[0][makeFieldName]" when all the
other browsers are returning the correct field?
It doesn't make any different whether I use document.forms[0][makeFieldName]
or actually specify the name of the form, as in
document["thisFormName"][makeFieldName]. In either case it works everywhere
but in Windows / IE6.
Anybody have any idea why the client is confused and returning the first
form element rather than the named one?
Thanks!
doug