Closed Bug 331872 Opened 18 years ago Closed 17 years ago

input file types width both id and name attributes the getElementById method doesn't work

Categories

(Firefox :: General, defect)

1.5.0.x Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: rotten_eye, Unassigned)

Details

(Whiteboard: CLOSEME 07/05)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1

when I have an input element with type=file and both id and name attributes set the javascript hetElementById() method can't get that form object.

Bad example:

   <input name="blueFile" id="blueFile" type="file" title="lol">

when I execute this peace of code:

   document.getElementByID('blueFile').disabled = true;
  or
   document.formName.blueFile.disabled = true;

I have an javascript error: "blueFile" doesn't have any properties


Good Example:

   <input name="blueFile" type="file" title="lol">

javascript:

   document.formName.blueFile.disabled = true;

it works fine....

With input file types elements you can't use the id and name attributes if you want refer to the object later with javascript.

Reproducible: Always
careful with spelling and casing, a typo in code can be disastrous:
"getElementById" not "getElementByID" not "hetElementById"
Did you actually copy the code, or did you retype it and allow for a typo?
Reporter, do you still see this problem with the latest Firefox 2? If not, can you please close this bug as WORKSFORME. Thanks!
Whiteboard: CLOSEME 07/05
Version: unspecified → 1.5.0.x Branch
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Resolution: FIXED → WORKSFORME
You need to log in before you can comment on or make changes to this bug.