FIX: Form.Submit Method Doesn't Use Form.Action Property

Last reviewed: September 30, 1997
Article ID: Q163623
The information in this article applies to:
  • Microsoft Internet Explorer, version 3.0
  • Microsoft ActiveX SDK, version 1.0

SYMPTOMS

When you create a form in an HTML page, using scripting to set the form.action property and calling form.submit has no effect, for example:

   <HTML>
   <HEAD>
   <TITLE>Action element in a Form</TITLE>
   </HEAD>

   <FORM NAME="Form1">
   <INPUT TYPE="BUTTON" NAME="Button1">
   <INPUT TYPE="TEXT" NAME="Text1">
   </FORM>

   <SCRIPT LANGUAGE="VBSCRIPT">
   Sub Button1_OnClick
       form1.action ="http://www.microsoft.com"
   ' this will not work
       form1.submit
   End Sub
   </SCRIPT>
   </HTML>

RESOLUTION

Call the window.navigate method or set the window.location.href property. However, this sets the method to "GET" as opposed to "POST." You'll have to pass the contents of the form yourself:

   <HTML>
   <HEAD>
   <TITLE>Action element in a Form</TITLE>
   </HEAD>

   <FORM NAME="Form1">
   <INPUT TYPE="BUTTON" NAME="Button1">
   </FORM>

   <SCRIPT LANGUAGE="VBSCRIPT">
   Sub Button1_OnClick
      window.navigate "http://www.microsoft.com?Text1=" &
      form1.text1.value
      ' or you can also do:
      ' window.location.href = "http://www.microsoft.com?Text1=" &
   ' form1.text1.value
   End Sub
   </SCRIPT>
   </HTML>

If you don't need to set the URL dynamically via scripting, you can always hard code it into the <FORM> tag using the ACTION option:

   <FORM NAME="Form1" ACTION="http://www.microsoft.com">

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in Internet Explorer 4.0.

Keywords          : AXSDKIESripting AXSDKSripting vbObjMdlIE
Technology        : kbInetDev
Version           : 1.0
Platform          : WINDOWS
Issue type        : kbbug
Solution Type     : kbfix


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.