PRB: Form.Reset is not Supported in Internet Explorer 3.0x

ID: Q190892


The information in this article applies to:


SYMPTOMS

When attempting to call the reset method on a form object from a script, Internet Explorer reports the following error:

[Line: xx] Object doesn't support this property or method.
The same code functions correctly in Internet Explorer 4.0, resetting the form elements to their default values.


CAUSE

The versions of Internet Explorer listed above do not support a reset method on the form object.


RESOLUTION

By placing an input element of type RESET on the form, the click event of that button can be invoked from script.


STATUS

Internet Explorer 4.0 supports a reset method on the form object.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Copy and paste the following HTML into a text file and load it into Internet Explorer 3.x.
    
      <HTML>
      <HEAD>
      <SCRIPT>
      function DoReset()
      {
         // -- The follow will result in a script error:
         document.oForm.reset();
      }
      </SCRIPT>
      </HEAD>
      <BODY>
      <FORM NAME=oForm>
      <INPUT TYPE=BUTTON VALUE="Pseudo-Reset" onClick="DoReset()">
      <INPUT TYPE=CHECKBOX>
      <INPUT TYPE=TEXT VALUE="Default">
      </FORM>
      </BODY>
      </HTML>
     


  2. Modify the form values, and click the Pseudo-Reset button.


Workaround

To workaround this lack of functionality in Internet Explorer 3.0x, follow these steps:

  1. Change the following line
    
    document.oForm.reset(); 
    to the following:
    
    document.oForm.btnReset.click(); 


  2. Include a button of type RESET on the form:
    
     <INPUT TYPE=RESET NAME=btnReset> 


Additional query words:


Keywords          : kbIE300 kbIE301 kbIEObj kbScript kbIE302 
Version           : WINDOWS:3.0,3.01,3.02
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: May 3, 1999