HTML element: <form>

Availability

Partial support as of BlackBerry®
Device Software version 3.7.

Full support as of BlackBerry Device Software version 4.6

The <form> element specifies a form that gathers information from the user. Users can submit a form by using the <input> or <button> elements in which type=”submit”. After a submission, the form collects the names and values of enclosed <input>, <select>, and <textarea> elements and submits the query as part of the request (GET) or as post data (POST).

Differences between HTML, XHTML, and XHTML-MP

None.

Attributes

Attribute

Value(s)

Description

Supported in

accept

content_type_list

This attribute specifies a list of valid content types for the form data.

4.6 or later

accept-charset

charset_list

This attribute specifies a list of valid character sets for form data. The default value is accept-charset=”unknown”.

4.6 or later

action

URI

Required. This attribute provides a URI to which the form is submitted.

3.7 or later

enctype

content_type

This attribute specifies the content type the form data is encoded with. The BlackBerry® Browser
sets the value to enctype=”application/x-www-form-urlencoded”.

3.7 or later

method

get

post

This attribute specifies the HTTP method used to send the data to the server

get: Default. This method sends form data as part of the URL, in the form action_URL?name1=value1&name2=value2....
This method can only be used if the form data is less than 100 characters.

post: This method sends the form data as part of the request.

3.7 or later

name

text

Deprecated. This attribute specifies a unique name so that the form can be referred to in style sheets or scripts. Use the id attribute instead.

3.7 or later

onreset

script

This event attribute defines the script to run when the form data is submitted.

4.0 or later

onsubmit

script

This event attribute defines the script to run when the form is reset.

4.0 or later

target

frame_target

This attribute specifies where the target document will be opened. The value can be the id attribute of the target frame, or can have one of the following special values:

_blank: Default. The document opens in a new window.

_self: The document opens in the current frame.

_parent: The document opens in the parent frameset.

_top: The document opens in the full window.

4.6 or later

Common attributes

—

The <form> element supports the following common attributes:

class

dir

id

lang

style

title

4.6 or later

Event attributes

—

In addition to the onreset and onsubmit events, the <form>
element also supports the following events: