Closed Bug 113652 Opened 23 years ago Closed 23 years ago

Options list can not be cleared by a function call

Categories

(Core :: DOM: Events, defect)

x86
Windows NT
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: jw_12, Assigned: joki)

Details

From Bugzilla Helper: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.6) Gecko/20011120 BuildID: 2001112009 An Options Listbox can not be cleared by assigning options[0].selected= false Worked OK in Mozilla 0.9.5 (Build ID 2001101117). Works OK in Nav 4.7X See example below Reproducible: Always Steps to Reproduce: 1.Click on the Clear button 2.The option box does not get cleared Actual Results: The option box is not cleared Expected Results: option box is cleared Example to demonstrate the bug: <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript"> function init() {document.form1.menu1.options[0].selected= false} </script> </head> <body> <form name="form1"> <input type="button" name="Button1" value="Clear" onClick="init()"> <br><br> <select name="menu1"> <option>A1</option> <option>A2</option> </select> </form> </body> </html>
Um... a size="1" select must always have a selected option. If you make it size not 1, this code will work. I see identical behavior here in Mozilla and Netscape 4 (both on Linux)
Yes. That this worked pre-0.9.6 was bad behavior. It's fixed now. :) In all cases that I am aware of, a single select with non-disabled options always manages to keep a selected option. Hmm, note to self: if a <select> has only disabled options in it, and we set one of them to disabled=false, will that one be selected? I am pretty sure that enabling an optgroup does not do this. Enabling the select itself needs to perform the action as well. All three of these cases *should* select something.
Setting INVALID per comments from BZ and JK
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
Status: RESOLVED → VERIFIED
verifying
You need to log in before you can comment on or make changes to this bug.