The Form Object

The Form object represents a form created by the <FORM></FORM> tags. The Form object can be accessed as a property of the Document object. Using forms in VBScript is similar to using forms in Visual Basic for Applications. Any controls contained within the <FORM></FORM> tags are accessed with the Form.Control.Property syntax. Additionally, the Internet Explorer provides complete support for all of the events for a control contained in a form. Tables 3-8, 3-9, and 3-10 show the properties, method, and event for the Form object.

Table 3-8.Form Object Properties

Property Type Description Usage
Action String Returns or sets the ACTION attribute. MyForm.Action="http://www.vb-bootcamp"
Encoding String Returns or sets the ENCODING attribute. MyForm.Encoding="text/html"
Method String Returns or sets the METHOD attribute. MyForm.Method="POST"
Target String Returns or sets the TARGET attribute. MyForm.Target= "NewWindow"
Elements Object Returns an Elements array. Set MyObject=MyForm.Elements(1)
Hidden Not yet implemented.

Table 3-9.Form Object Method

Method Return Type Description Usage
Submit None Submits form contents. MyForm.Submit

Table 3-10.Form Object Event

Event Arguments Description Usage
OnSubmit None Fires when form contents are submitted. MyForm.OnSubmit= "VBScript code"

© 1996 by Scot Hillier. All rights reserved.