[Webkit-unassigned] [Bug 8455] New: selectedIndex for a select after a Form reset() has wrong value
bugzilla-daemon at opendarwin.org
bugzilla-daemon at opendarwin.org
Tue Apr 18 06:44:38 PDT 2006
http://bugzilla.opendarwin.org/show_bug.cgi?id=8455
Summary: selectedIndex for a select after a Form reset() has
wrong value
Product: WebKit
Version: 417.x
Platform: Macintosh
OS/Version: Mac OS X 10.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: Forms
AssignedTo: webkit-unassigned at opendarwin.org
ReportedBy: czisopoulos at mac.com
In a simple for with a <select/> two <option/> tags, when a page loads
selectedIndex is 0 (the first option). After calling document.forms[0].reset(),
selectedIndex is -1
Only by explicitly specifying an option as selected, will you get the expected
behaviour after a reset.
<html>
<head>
<title>test</title>
<script type="text/javascript" language="javascript" charset="utf-8">
function selectBug() {
alert("Before Form.reset() selectedIndex is " +
document.forms[0].elements[0].selectedIndex);
document.forms[0].reset();
alert("AFTER Form.reset() selectedIndex is " +
document.forms[0].elements[0].selectedIndex);
}
</script>
</head>
<body onload="selectBug()">
<form action="test_submit" method="post">
<select id="select_1" name="event[event_type_id]">
<option value="1" >Value 1</option>
<option value="2" selected>Value 2</option>
</select>
<input name="commit" type="submit" value="Submit" />
</form>
</body>
</html>
--
Configure bugmail: http://bugzilla.opendarwin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the webkit-unassigned
mailing list