Closed Bug 225699 Opened 21 years ago Closed 21 years ago

Using keyboard to change selection does not trigger onchange event

Categories

(Core :: DOM: Events, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 126379

People

(Reporter: hbal, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 Firebird/0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6a) Gecko/20031030

After tabbing to a select box, up or down is used to change a selected value.
Expected behavior: OnChange event should fire
Observed behavior: Event is not fired.

Note: When a mouse is used to change the selection, the OnChange event IS fired.
Also the OnChange event fires as expected in IE 6.0

Browsers in which behavior is observed: Mozilla 1.2, Mozilla 1.6a, Firebird 0.7

Code to reproduce the problem:
<html>
<head>
<script>
function submitForm() {
	document.forms[0].sFormCommand.value="init";
	if (document.forms[0].sViewIndex!=null) {
		document.forms[0].sViewIndex.options[0].selected=true;
	}
	alert("OnChange event fired \n Click OK to contine.");
	//document.forms[0].submit();

}
</script> 
</head>

<body>
<form>
	<select onchange="submitForm()" name="sViewType">
		<option selected="selected" value="All">All</option>
		<option value="A">A</option>
		<option value="B">B</option>
	</select>
	<input type="hidden" name="sFormCommand" value="viewlisting">
</form>
</body>
</html>

Reproducible: Always

Steps to Reproduce:
1. Paste the code above and save as a .html file
2. View in browser
3. Change selection using mouse, a small alert box should appear, confirming
that the onchange event was fired
4. Now change using keyboard only, and alert box will not appear

Actual Results:  
Nothing happens

Expected Results:  
The onChange event should fire, causing the submitForm() function to be
trigerred, causing a alert box to appear.
Dupe of Bug 126379 see bug 110800 for the main reason
Note when you hit the tab or enter button onchange is fired.

*** This bug has been marked as a duplicate of 126379 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.