Help Center

Local Navigation

HTML element: <input>

Availability

BlackBerry® Device Software3.7 or later

The <input> element defines a user input object. The BlackBerry® Browser renders <input> elements according to the value of the type attribute.

In BlackBerry Device Software version 4.7.1 and later, the BlackBerry Browser supports the full list of input types that are specified by the HTML 5 Forms specification. However, the BlackBerry Browser does not support all the attributes that are identified in the specification.

Attributes

Attribute

Value

Description

Compatible input types

Availability

accept

MIME-types

This attribute specifies a comma-separated list of MIME types that are accepted when a file is submitted with the form.

  • file

4.2 or later

alt

text

This attribute specifies the text that appears when an image is unavailable or cannot be displayed.

  • image

3.7 or later

checked

When specified, this attribute indicates that, by default, the check box or radio button control is selected when the form is displayed. Unless the state of the form control is changed, the value of the form control is included when the form is submitted.

You can specify the checked attribute for one or more check box controls in a group.

You can specify the checked attribute for only one radio button control in a group. If you specify the checked attribute for more than one radio button element in a group, the last control with the checked attribute specified is selected when the form is displayed. The checked attribute is ignored for all other radio button controls in the group.

  • checkbox
  • radio

3.7 or later

inputmode

inputmode-tokens

This attribute provides a whitespace-separated list of the input mode tokens. The tokens inform the browser of the language scripts or modifiers that the field should accept.

The BlackBerry device must support the language that is associated with the specified input mode tokens. If the BlackBerry device does not support any of the languages that correspond to the specified input mode tokens, then the field uses the default language of the BlackBerry device.

  • email
  • password
  • search
  • text
  • url

5.0 or later

list

datalist_id

This attribute references a <datalist> element within the page.

The <datalist> contains <option> elements that represent suggestions that the user can select when entering text into the text field control. The value of the text field is set to the value of the option.

The browser filters out options that are inappropriate for the input type.

  • email
  • number
  • search
  • text
  • url

5.0 or later

max, min

Input-type dependent

These attributes specify a maximum or minimum value for the form control. You must specify a value that is valid for the input type. For example, if type="date", then the value for max must be a valid date.

If you define both max and min, the value of max must be greater than the value of min.

For input types other than range, users can specify a value that is greater than the maximum or less that the minimum values. However, the browser will change the value to the specified max or min value.

For the range input type, the default max and min values are 100 and 0, respectively.

  • date
  • datetime
  • datetime-local
  • month
  • range
  • time
  • week

5.0 or later

maxlength

number

This attribute specifies the maximum number of characters that are allowed in a text field.

  • email
  • password
  • search
  • text
  • url

3.7 or later

name

text

This attribute specifies a unique name for the <input> element.

This is the name part of the name-value pair that associates the form control with the user's input.

This attribute is required, except with type="submit" and type="reset".

All input types

3.7 or later

placeholder

text

This attribute specifies the placeholder text for a text field. This text is not a default value for the field. It provides a short hint to aid the user in entering the required data correctly.

Placeholder text is displayed in grey text, and appears only if no value attribute is specified for the text field.

  • email
  • password
  • search
  • text
  • url

5.0 or later

readonly

When specified, this attribute indicates that the user is not allowed to change the value.

  • email
  • password
  • search
  • text
  • url

4.6 or later

required

When specified, this attribute indicates whether or not a value is required for the form control.

If the user does not provide a required value for a form control, the browser displays a dialog box that asks the user to complete the form, and then sets the focus to the empty form control.

The required attribute is superceded by the value that is specified for the -wap-input-required CSS property. For example, if you specify -wap-input-required: false in the style sheet, but specify the required attribute in the HTML markup, the value is not required.

All input types except:
  • color
  • image
  • reset
  • submit

5.0 or later

size

length

This attribute specifies the size of the input element. You should use CSS styles to specify the layout of <input> elements.

  • email
  • password
  • search
  • text
  • url

4.6 or later

src

URI

This attribute specifies the image that the browser displays.

  • image

4.6 or later

step

This attribute specifies the increments of the slide bar control, starting from the min value. The default step value is 1.

If you set the value attribute to an invalid value, based on the min and step values, the browser rounds the value down to the nearest valid value.

For example, if min="5" and step="5" and value ="7", when the browser renders the slide bar control, value is rounded down to 5.

  • range

5.0 or later

type

input_type

This attribute specifies the type of form control that you want to add to the form.

3.7 or later

value

text

This attribute defines the default value that is submitted with the form if the user does not specify a value, except for the following input types:

  • For the button, reset, and submit input types, this attribute specifies the text that the browser displays in the button.
  • For the checkbox and radio input types, this attribute specifies the value that the browser passes to the server when the user selects the option.

    The value attribute is required for the checkbox and radio input types.

All input types except:

  • file

3.7 or later

Common attributes

The <input> element supports the class, dir, id, lang, style, and title attributes.

For more information, see Common attributes.

Event attributes

The <input> element supports the onblur, onchange, onclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, and onselect events.

For more information, see HTML event attributes.

Index


Was this information helpful? Send us your comments.