PRB: "Is Not An Object" Error When Submitting Incomplete Doc (190279)



The information in this article applies to:

  • Microsoft Visual Basic, Scripting Edition 2.0
  • Microsoft Visual Basic, Scripting Edition 3.0
  • Microsoft Internet Explorer (Programming) 4.0
  • Microsoft Internet Explorer (Programming) 4.01

This article was previously published under Q190279

SYMPTOMS

When an HTML page with a form is dynamically created using document.write() and the page does not include fundamental HTML tags and is submitted, the following error occurs in Internet Explorer 4.01:
Error: <reference to the form> is not an object

CAUSE

Fundamental HTML tags should always be used in HTML pages. The lack of them can potentially cause a problem in various browsers or versions of browsers.

RESOLUTION

Adding <html>, <head>, <title>, and <body> tags to the dynamically created document prevents the error from occurring.

STATUS

Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

Place the following code in the onclick event of a button in one frame of a two-frame URL and name the other frame "frame2." When clicking the button, the error appears. The added lines to make it work are commented:
   parent.frame2.document.open() ;

   // added line
   parent.frame2.document.write('<HTML><HEAD><TITLE>a</TITLE>') ;
   parent.frame2.document.write('</HEAD><BODY>') ;

   parent.frame2.document.write('<form method="POST" name="list" ') ;
   parent.frame2.document.write('<action="feedback.exe">') ;

   parent.frame2.document.write('<input type="hidden" name="Name" ') ;
   parent.frame2.document.write('value="x">') ;

   parent.frame2.document.write('</form>') ;

   // added line
   parent.frame2.main.document.write('</BODY></HTML>') ;

   // error occurs here if the other commented lines are not included.
   parent.frame2.main.document.list.submit() ;
   parent.frame2.document.close() ;
				

Modification Type:MinorLast Reviewed:3/3/2005
Keywords:kberrmsg kbprb kbScript KB190279