Share via


FORM XHTML Element

Send Feedback

The FORM element specifies that the contained controls are part of a form. This is a block element and requires a closing tag.

Using this Element

There are some common properties and collections that apply to all the elements of the document object model, see Common Properties for All DOM Elements in Internet Explorer Mobile.

This element can be used within a web page with attributes.

This element can be used within scripts where it will have properties, events and methods.

Attributes

Attribute Value PPC SP Description
ACTION URL Yes Yes Specifies the URL to which the FORM content is to be sent for processing.
CLASS   Yes Yes Associates the element with a CSS style.
Note   Supported only for devices running Windows Mobile 2003 software or later.
ENCTYPE MIME Yes Yes
Note   Always defaults to application/x-www-form-urlencoded since INPUT TYPE=FILE is not supported.
ID   Yes Yes Uniquely identifies the element within a document.
Note   Supported only for devices running Windows Mobile 2003 software or later.
METHOD   Yes Yes Specifies how the form data is sent to the server.
  get Yes Yes Append the arguments to the action URL and open it as if it were anchor. If the ACTION contains a question mark and a query string, when submitted the browser sends the action URL (including its question mark and query string) along with the arguments.
  post Yes Yes Sends the data through an HTTP post transaction.
NAME String Yes Yes Specifies the name for the FORM so that it can be referred to from script.
ONRESET   Yes Yes An event that occurs when a form is reset.
Note   Supported only for devices running PocketPC 2002 and Smartphone 2002 software or later.
ONSUBMIT   Yes Yes An event that occurs when a form is submitted.
Note   Supported only for devices running PocketPC 2002 and Smartphone 2002 software or later.
STYLE   Yes Yes Provides the definition of the CSS styles used for this element.
Note   Supported only for devices running Windows Mobile 2003 software or later.
TARGET   Yes No  
  _blank Yes No Causes Internet Explorer Mobile to navigate the topmost document to the HREF.
  _parent Yes No Causes the immediate parent of the frame to navigate to the HREF.
  _self Yes No  
  _top Yes No Causes Internet Explorer Mobile to navigate the topmost document to the HREF.

Scripting Properties

Property Type Access Comments
action string Read/Write Sets or retrieves the URL to which the FORM content is sent for processing
encoding string Read Only Read only property which retrieves the MIME encoding for the form. The value is always "application/x-www-form-urlencoded".
method string Read/Write Read/write property which specifies how the form data is sent to the server. The only valid values are "post" and get".
name string Read Only Read only property that retrieves the name of the FORM.
target string Read/Write Read/write property that sets or retrieves the TARGET of the FORM. See FORM TARGET attribute for the possible values and behavior.

Scripting Events

Event Supported Comment
onreset Yes This event fires when a form reset is initiated by the user.
onsubmit Yes This event fires when a form is about to be submitted. Note: this event only fires when the submit is initiated by the user. It will not fire if the submit() method is called on the form.

Scripting Methods

Method Support Comments
reset Yes syntax:

form.reset()

  • simulates a mouse click on the reset button which resets the form back to its initial state.
submit Yes syntax:

form.submit()

  • submits the form but does NOT fire the onsubmit event.

Scripting Collections

Collections Arguments Support Comments
elements object Yes Collection of all the controls in a given form. Note that for browser input type=image controls are included in this collection.

syntax:

[colElements=]form.elements

[oObject=]form.elements(vIndex)

colElements

  • Collection of controls

oObject

  • Reference to an individual item in the array of elements contained by the object.

vIndex

  • Required. Integer that specifies the element or collection to retrieve. The value of vIndex cannot be accessed as a string.
   length long Read Only Contains the number of elements in the elements collection.
   item ([optional] variant name,
[optional] variant index)
Yes  

Requirements

Pocket PC: Windows Mobile 5.0 and later
Smartphone: Windows Mobile 5.0 and later
OS Versions: Windows CE 5.01 and later

See Also

XHTML Elements

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.