Home > Element Reference : Textbox

Contents

### Textbox

A text input field in which the user can enter text. It is similar to the HTML input element. Only one line of text is displayed by default. The multiline attribute can be specified to display a field with multiple rows.

More information about Textbox

Example:

        <label control="your-name" value="Enter your name:"/>
        <textbox id="your-name"/>

#### Attributes:

Attributes inherited from XUL Element

disabled

If this attribute is set to true, the textbox is disabled. This is usually drawn with the text in grey. If the textbox is disabled, the function of the button cannot be performed. Leave the attribute out entirely for a regular enabled button.

focused

This attribute is set to true if the textbox element is focused.

maxlength

The maximum number of characters that the textbox allows to be entered.

multiline

If true, the textbox displays multiple lines. If the user presses ENTER, a new line is started. If false, the textbox only allows entry of one line.

oninput

This event is sent when a user enters text in a textbox. This event is only called when the text displayed would change, thus it is not called when the user presses non-displayable keys.

readonly

If set to true, then the user cannot modify the value of the textbox. However, the value may still be modified by a script.

size

The number of characters that can be displayed in the textbox.

type

You can set this attribute to the special value 'password' to create a textbox that hides what it types. This is usually used for password entry fields. Use the value 'autocomplete' to create a textbox that supports autocomplete. Use the value 'text' for a regular textbox.

value

The default value entered in the textbox.

wrap

#### Properties and Methods:

Properties and Methods inherited from XUL Element

controllers
disabled
maxlength
readonly
selectionEnd

Get or modify the end of the selected portion of the field's text. Use in conjuction with the selectionEnd property. The value specifies the index of the character after the selection. If this value is equal to the selectionStart property, no text is selected, but the value indicates the position of the cursor within the textbox.

selectionStart

Get or modify the beginning of the selected portion of the field's text. Use in conjuction with the selectionEmd property. The value specifies the index of the first selected character.

setSelectionRange ( start , end )

Sets the selected portion of the textbox, where the start argument is the index of the first character to select and the end argument is the index of the character after the selection. Set both arguments to the same value to move the cursor to the corresponding position.

size
textLength

Holds the length of the text entered in the textbox. This property is read only.

type
value

Copyright (C) 1999 - 2002 XULPlanet.com