Microsoft KB Archive/290717

= BUG: SELECT Element Causes Application Error in Internet Explorer =

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:

The instruction @ 0x70e45ed2 referenced at 0x00000022. The memory could not be read.



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: 1 



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
  In any HTML editor, copy the following code, and save the file: <script LANGUAGE=&quot;JAVASCRIPT&quot;>

function ClearValue { document.form1.select1.value = &quot;&quot; document.form1.select1.focus }

<body LANGUAGE=&quot;javascript&quot; onload=&quot;ClearValue&quot;>

<form Name=&quot;form1&quot; METHOD=&quot;post&quot;> <select name=&quot;select1&quot;> <option value='1'>1 <option value='2'>2 <option value='3'>3

</li> Run the new Web page.</li> With the select box clear, press any key except 1, 2 or 3. You receive the above-mentioned application error.</li></ol>

<div class="references_section">