Closed
Bug 163437
Opened 23 years ago
Closed 23 years ago
Disabled select does not automatically select an option
Categories
(Core :: Layout: Form Controls, defect, P3)
Core
Layout: Form Controls
Tracking
()
RESOLVED
FIXED
mozilla1.3beta
People
(Reporter: martin.pecina, Assigned: john)
References
()
Details
(Whiteboard: [FIX])
Attachments
(3 files)
|
1.14 KB,
text/html
|
Details | |
|
1.60 KB,
text/html
|
Details | |
|
705 bytes,
patch
|
peterlubczynski-bugs
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.1b) Gecko/20020721
Build Identifier: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.1b) Gecko/20020721
When You can buy some goods, goods is not added to the shopping basket and JS
console shows this problem:
Error: uncaught exception: [Exception... "Index or size is negative or greater
than the allowed amount" code: "1" nsresult: "0x80530001
(NS_ERROR_DOM_INDEX_SIZE_ERR)" location: "http://www.tea.cz/cajovna/malobj.js
Line: 87"]
This JS problem has Mozilla from version 1.0+ Older version (0.9x-) works
normally without this error. Without this error works all Netscape browsers to
7.0 version too. 7.0+ version has the same problem. MS Explorer (4.0+) runs
without any JS error.
Reproducible: Always
Steps to Reproduce:
1.In the browser open http://www.tea.cz/cajovna/listobj.htm
2.Select some goods and click on the shopping basket icon
3.In the Shopping basket contents You will see nothing (JS error)
4.Open JS Console to see this error
Actual Results:
In the Shopping basket contents You will see nothing (JS error)
Normal function (after Your fix) is that You will see added goods, description
and price.
Expected Results:
Find this bug in the browser JS engine and fix it, please.
Error: uncaught exception: [Exception... "Index or size is negative or greater
than the allowed amount" code: "1" nsresult: "0x80530001
(NS_ERROR_DOM_INDEX_SIZE_ERR)" location: "http://www.tea.cz/cajovna/malobj.js
Line: 87"]
Comment 1•23 years ago
|
||
Unable to connect to this URL.
Comment 2•23 years ago
|
||
Martin: thank you for such a thorough report! The error you found,
NS_ERROR_DOM_INDEX_SIZE_ERR, shows this is either a coding error
at the site or a problem in the DOM. Reassigning to DOM component.
I would like to debug this, but like Frederic, I am unable to
navigate to the site. I keep getting this error:
www.tea.cz could not be found
Please check the name and try again -
Is there a typo in the URL you gave?
http://www.tea.cz/cajovna/listobj.htm
Assignee: rogerl → jst
Component: JavaScript Engine → DOM Level 0
QA Contact: pschwartau → desale
Comment 3•23 years ago
|
||
Tried to connect to this URL from Belgium and from the Netherlands: both
attempts were unsuccessful.
Is this the first case of a server being bugzilla-ed? (It just doesn't sound as
cool as ./-ed, though)
Comment 4•23 years ago
|
||
The code in question is:
var hod = document.DCForm["x_" + i].options[document.DCForm["x_" +
i].selectedIndex].value;
Now as it happens, document.DCForm["x_" + i].selectedIndex is "-1" in this
case... so you get that error.
Comment 5•23 years ago
|
||
Martin, thank you for spotting the problem! The issue is that a disabled
select does not automatically preselect its first option, unlike an enabled
select. This is obvious in the display of the selects in this testcase and
clicking on the text should show the selectedIndex and the selected value,
which are -1 and exception in the case of the disabled select. Note that
setting a chosen option as "selected" _will_ force the disabled select to
preselect it, so this could be a temporary workaround for the page if that's
needed.
Comment 6•23 years ago
|
||
jkeiser, this is all yours.
Assignee: jst → jkeiser
Status: UNCONFIRMED → NEW
Component: DOM Level 0 → HTML Form Controls
Ever confirmed: true
OS: Windows NT → All
QA Contact: desale → tpreston
Hardware: PC → All
Comment 7•23 years ago
|
||
The issue is the following code in nsHTMLSelectElement::SelectSomething:
1755 // Don't select anything if we're disabled
1756 PRBool isDisabled = PR_FALSE;
1757 GetDisabled(&isDisabled);
1758 if (isDisabled) {
1759 return;
1760 }
I suspect we just want to remove it... depends on what IE does; NS4 does not
seem to support "disabled", so testing with it is pretty pointless.
| Assignee | ||
Comment 8•23 years ago
|
||
The difference is deliberate. We don't ever select a disabled option unless
the page designer explicitly selects it themselves via an attribute or JS.
It's unexpected behavior even if IE does it. I don't think it's right to make
the disabled option "feature" the same as IE, and by inference it isn't right
to fix the disabled select problem.
The option that will be selected initially is deliberately not defined by the
spec, as well.
| Assignee | ||
Comment 9•23 years ago
|
||
OK, I relent. It can be argued that a disabled *select* is different from a
select with disabled *options*; since a disabled select is not going to submit
you aren't doing anything strange by selecting options in it; you still don't
select disabled *options* in the disabled select, because if it were made
un-disabled you would end up submitting them.
Status: NEW → ASSIGNED
Priority: -- → P3
Summary: Probably JS engine error on Mozilla Browser from version 1.0 → Disabled select does not automatically select an option
Target Milestone: --- → mozilla1.3beta
| Assignee | ||
Comment 10•23 years ago
|
||
Precisely as bz said it would be.
| Assignee | ||
Updated•23 years ago
|
Attachment #109506 -
Flags: superreview?(bzbarsky)
Attachment #109506 -
Flags: review?(peterl)
| Assignee | ||
Updated•23 years ago
|
Whiteboard: [FIX]
Updated•23 years ago
|
Attachment #109506 -
Flags: superreview?(bzbarsky) → superreview+
Comment 11•23 years ago
|
||
Comment on attachment 109506 [details] [diff] [review]
Patch
r=peterl
Attachment #109506 -
Flags: review?(peterl) → review+
| Assignee | ||
Comment 12•23 years ago
|
||
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•