Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

The FORMelement 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, Methods and Collections for the HTML 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, eventsand methods.

Attributes

The following table shows items that Internet Explorer Mobile supports.

Attribute Value Description

ACTION

URL

Specifies the URL to which the FORM content is to be sent for processing.

CLASS

 

Associates the element with a CSS style.

Note:
Supported only for devices running Windows Mobile 2003 software or later.

ENCTYPE

MIME

Note:
Always defaults to application/x-www-form-urlencoded since INPUT TYPE=FILE is not supported.

ID

 

Uniquely identifies the element within a document.

Note:
Supported only for devices running Windows Mobile 2003 software or later.

METHOD

 

Specifies how the form data is sent to the server.

 

get

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

Sends the data through an HTTP post transaction.

NAME

String

Specifies the name for the FORM so that it can be referred to from script.

ONRESET

 

An event that occurs when a form is reset.

Note:
Supported only for devices running PocketPC 2002 and Smartphone 2002 software or later.

ONSUBMIT

 

An event that occurs when a form is submitted.

Note:
Supported only for devices running PocketPC 2002 and Smartphone 2002 software or later.

STYLE

 

Provides the definition of the CSS styles used for this element.

Note:
Supported only for devices running Windows Mobile 2003 software or later.

TARGET

 

 

 

_blank

Causes Internet Explorer Mobile to navigate the topmost document to the HREF.

 

_parent

Causes the immediate parent of the frame to navigate to the HREF.

 

_self

 

 

_top

Causes Internet Explorer Mobile to navigate the topmost document to the HREF.

Scripting Properties

The following table shows items that Internet Explorer Mobile supports

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/Write

Read only property which retrieves the MIME encoding for the form. The value is always “application/x-www-form-urlencoded”.

length

long

Read

 

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

Read only property that retrieves the name of the FORM.

offsetHeight

Number

Read-only

Contains the height of the object in pixels, relative to the parent element.

offsetLeft

Number

Read-only

Contains the number of pixels from the left of the parent element.

offsetParent

String

Read-only

Contains a reference to the container object that defines the offsetTop and offsetLeft properties of the object.

offsetTop

Number

Read-only

Contains the number of pixels from the top of the parent element

offsetWidth

Number

Read-only

Contains the width of the object in pixels, relative to the parent element.

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

The following table shows items that Internet Explorer Mobile supports

Event Comment

onreset

This event fires when a form reset is initiated by the user.

Note:
Supported only for devices running Smartphone 2002 and Pocket PC 2002 software or later.

onsubmit

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

The following table shows items that Internet Explorer Mobile supports.

Method Arguments Comments

getAttribute

 

syntax:

vAttrValue=form.getAttribute(sAttrName[,iFlags])

  • Returns the value of the specified attribute. If the attribute is not present then a NULL is returned.

    sAttrNameis a String containing the name of the attribute.

    iFlagsis an integer that specifies one or more of the following:

    0 (Default) Performs a property search that is not case-sensitive, and returns an interpolated value if the property is found.

    1 Performs a case-sensitive property search. To find a match, the uppercase and lowercase letters in sAttrNamemust exactly match those in the attribute name.

    2 Returns the value exactly as it was set in script or in the source document.

reset

 

syntax:

form.reset()

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

submit

 

syntax:

form.submit()

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

Scripting Collections

The following table shows items that Internet Explorer Mobile supports.

Collections Arguments Support Comments

elements

object

Yes

Collection of all the controls in a given form. Note that for browser input type=imagecontrols 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 vIndexcannot be accessed as a string.

   length

long

Read

Contains the number of elements in the elements collection.

   item

([optional] variant name, [optional] variant index)

Yes

 

Requirements

Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later

See Also