Closed
Bug 88076
Opened 23 years ago
Closed 23 years ago
returned Selected Index is -1
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
VERIFIED
WORKSFORME
People
(Reporter: stummala, Assigned: jst)
References
Details
Attachments
(1 file)
(deleted),
text/html
|
Details |
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (Windows NT 5.0; U)
BuildID: Linux2001-06-20-06
document.write(document.getElementsByTagName('SELECT')[0].selectedIndex); always
returns -1 ..
Reproducible: Always
Steps to Reproduce:
<HTML>
<BODY>
<form>
<SELECT size="7">
<option>eeyore
<option>pooh
<option>piglet
<option>tigger
<option>owl
<option>rabbit
<option selected>elephant
<option>penguin
<option>#41
<option>you had time
<option>out of range
<option>crush
<option>gypsy
<option>language
<option>sometimes
</SELECT>
<SELECT size="2">
</SELECT>
</form>
<SCRIPT type="text/javascript">
document.write(document.getElementsByTagName('SELECT')[0].selectedIndex);
</SCRIPT>
</BODY>
</HTML>
use the above incase u cannot load the testcase
Actual Results: -1 was returned
Expected Results: expected return value=6
Comment 1•23 years ago
|
||
I see this with Mozilla 2001062204 on Win2k. I added a javascript alert to body
onload="alert(document.getElementsByTagName('SELECT')[0].selectedIndex)" and it
returns the correct value of 6. Perhaps the collection isn't initialized or the
selection isn't made until the page loads?
OS: Linux → All
Comment 2•23 years ago
|
||
Comment 5•23 years ago
|
||
Guys,
This bug sounds pretty important to me.
There are tons of websites which rely on selectedIndex value to redirect to
appropriate page. or to submit approriate selected value.
Examples are like www.carpoint.com
Comment 6•23 years ago
|
||
It seems this is only a problem while the page is loading. I don't know how
many sites would use the value of a select in inline script code. I'd expect it
to be rare. After load, it's fine, so submits should work correctly.
Comment 8•23 years ago
|
||
Similar to these bugs:
bug 89425 "JavaScript select on multiple select box is malfunctioning"
In certain circumstances, not possible to set this via JavaScript:
document.formA.selectA[i].selected = true;
Which in turn has been suggested as a duplicate of:
bug 86659 "Alteration of select widget by JavaScript broken"
> In Mozilla 0.9.1+ the ability for JavaScript to change the selected item in a
> select form widget is broken. The referenced URL is a simplified test of this
> bug which works under NS 4.7 and Moz 0.9.1 but is broken under Moz 0.9.1+
> When you click the button on the page, "Item 2" (which is form.sel.option[2])
> should become the selected option, but instead form.sel.option[0] is selected,
> the default.
Comment 9•23 years ago
|
||
Is this exact construct heavily used in the web at large? Using the testcase,
it does show that the answer is only wrong while the page is loading. That
seems to limit the exposure significantly (and isn't terribly different from
every other client with flaky behavior before the page is loaded - 4.x was
horrible in this regard.)
My impression is that Johnny has his hands full already, is anyone else
available to look at this? I can't really even consider it for PDT+ without a
patch.
Comment 10•23 years ago
|
||
This is due to the selected index not being set until the frame is loaded. It
is fixed in the patch for bug 34297. Adding dependency.
Depends on: 34297
Reporter | ||
Comment 11•23 years ago
|
||
interestingly if the size attribute is removed the selectedindex is set to 0
Comment 12•23 years ago
|
||
Fixed with bug 34297 landing.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 13•23 years ago
|
||
*** Bug 101720 has been marked as a duplicate of this bug. ***
Reporter | ||
Comment 15•23 years ago
|
||
Reopening bug. Failed on win2k build 2001-11-26 build
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Reporter | ||
Comment 16•23 years ago
|
||
this bug is a regression from 2001-11-09-09. adding the keyword regression
Keywords: regression
Comment 17•23 years ago
|
||
Worksforme build 2001120303 win2k. In the testcase it alerts Success! 6 - 6 and
document.writes 6.
Comment 18•23 years ago
|
||
Works for doron and jesus_X on #mozillazine as well in recent nightlies
Assignee | ||
Comment 19•23 years ago
|
||
WFM.
Status: REOPENED → RESOLVED
Closed: 23 years ago → 23 years ago
Resolution: --- → WORKSFORME
Reporter | ||
Comment 20•23 years ago
|
||
verified build 2001-12-07-10.
Status: RESOLVED → VERIFIED
Keywords: regression
Component: DOM: HTML → DOM: Core & HTML
QA Contact: stummala → general
You need to log in
before you can comment on or make changes to this bug.
Description
•