Closed
Bug 125109
Opened 24 years ago
Closed 22 years ago
Renaming a FORM element removes the next FORM element from the DOM.
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: hvandeca, Unassigned)
Details
Attachments
(2 files)
I cannot give you access to pages, but if you run the example below, I think It
will be quite clear what I mean.
The name attribute on an INPUT element is read/write. However, when you rename
an input element in a form, the internal representation of the FORM elements
gets screwed up. The HTML below demos the problem.
<HTML>
<HEAD>
<TITLE>Bugzilla</TITLE>
<SCRIPT type="text/javascript" language="javascript">
function DemoBug()
{
alert("Origal form elements before changes.");
var Elements = document.myform.elements;
for(var index = 0; index < Elements.length; index++)
{
alert("Name: " + Elements[index].name + " Value: " + Elements[index].value);
}
alert("Changing name on Form element1 form name1 to name1_x");
Elements[0].name = "name1_x";
alert("Form elements after changing the name of the first element.");
for(var index = 0; index < Elements.length; index++)
{
alert("Name: " + Elements[index].name + " Value: " + Elements[index].value);
}
alert("Notice that the second form element name2 is no longer there after
renaming name1.");
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="myform">
<INPUT name="name1" id="name1" value= "value1">
<INPUT name="name2" id="name2" value= "value2">
<INPUT name="name3" id="name3" value= "value3">
<INPUT name="name4" id="name4" type="button" value="Demo bug" onclick="DemoBug
()">
</FORM>
</BODY>
</HTML>
There are four FORM elements on this page. When you click the button, I show
the current FORM elements through an alert. I then change the name attribute of
the first FORM element from name1 to name1_x. Then I run through all the FORM
elements again. Notice that the first element has been removed and has been
added to the end of the array with the new name. This part is OK I guess.
However, the second element is no longer in the array. You can extrapolate from
this example. Anytime you change a FORM element's name, the next element in the
FORM somehow disappears. Since the name attribute on an INPUT field is
read/write, I should be allowed to do this.
| Reporter | ||
Comment 1•24 years ago
|
||
Attached demo page that demonstrates the bug.
Comment 2•24 years ago
|
||
over to dom level 0
Status: UNCONFIRMED → NEW
Component: DOM Core → DOM Level 0
Ever confirmed: true
Comment 5•22 years ago
|
||
WFM 2003042908, Windows 2000
Can anyone verify this?
Comment 6•22 years ago
|
||
Herman, could you please try this with a current Mozilla build? It also seems to
work for me with 1.6.
Comment 7•22 years ago
|
||
Worksforme as well, and we had some patches that could have fixed this... Going
out on a limb and marking so, but please reopen if this is still a problem.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → WORKSFORME
If we are talking about the more general problem that we modify the inputs in a
form, the order in the elements array does not match what is displayed, then
the problem is still there. In this example, a input is inserted in the middle
of the form, but in the elements array it shows up at the end. The same script
works fine on IE.
Comment 9•22 years ago
|
||
> If we are talking about the more general problem
We're not -- that problem is covered by another bug.
You need to log in
before you can comment on or make changes to this bug.
Description
•