Article ID: 290717
Article Last Modified on 5/11/2006
APPLIES TO
- Microsoft Internet Explorer (Programming) 5.5 SP1
This article was previously published under Q290717
SYMPTOMS
If the initial value of a SELECT element is set to null, and if the user selects an invalid option (if the chosen element does not contain an explicitly selected option, or if the chosen element does not point to an option that exists in the script), you may receive the following application error in Internet Explorer:
CAUSE
This problem occurs because the chosen value does not exist in the list of valid options.
RESOLUTION
There are two ways to work around this problem:
- Add a blank item at the beginning of the SELECT box. Check the value on submission. If the item is a blank item, notify the users that they must make a selection from the list.
Use the SELECTED attribute to leave a default value selected. For example:
<OPTION VALUE="3" SELECTED>1</OPTION>
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
MORE INFORMATION
Steps to Reproduce Behavior
In any HTML editor, copy the following code, and save the file:
<html> <head> <script LANGUAGE="JAVASCRIPT"> function ClearValue() { document.form1.select1.value = "" document.form1.select1.focus() } </script> </head> <body LANGUAGE="javascript" onload="ClearValue()"> <form Name="form1" METHOD="post"> <select name="select1"> <option value='1'>1</option> <option value='2'>2</option> <option value='3'>3</option> </select> </form> </body> </html>
- Run the new Web page.
- With the select box clear, press any key except 1, 2 or 3. You receive the above-mentioned application error.
REFERENCES
For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
237831 PRB: Problem Adding New Option to Select Box in Another Frame in Internet Explorer 5
239657 FIX: Removing Non-Visible Items from an HTML SELECT Box Causes General Protection Fault (GPF)
255610 PRB: CreateElement() for SELECT Options Is Slow in Internet Explorer 5
185123 PRB: SELECTED Attribute Not Honored After Refresh
265489 PRB: Approximately 200 or More SELECT Boxes in HTML Causes Slow and Unstable Performance in Windows 95 and Windows 98
For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:
Additional query words: kbie55 5.5 sp1 0x70e45ed2 0x00000022
Keywords: kbbug kbnofix kbdhtml KB290717