textNN 2   IE 3   DOM 1

The text object is a form control generated with an INPUT element whose TYPE attribute is set to "text". This object is the primary way of getting a user to enter single lines of text for submission to the server.

 
HTML Equivalent
<INPUT TYPE="text">
 
Object Model Reference
NN [window.]document.formName.elementName
[window.]document.forms[i].elements[i]
IE [window.]document.formName.elementName
[window.]document.forms[i].elements[i]
[window.]document.all.elementID
accessKeyNN n/a   IE 4   DOM 1
 Read/Write
 

A single character key that brings focus to the element. The browser and operating system determine whether the user must press a modifier key (e.g., Ctrl, Alt, or Command) with the access key to bring focus to the element. In IE 4/Windows, the Alt key is required, and the key is not case sensitive. Not working in IE 4/Mac.

 
Example
document.entryForm.myText.accessKey = "n"
 
Value
Single alphanumeric (and punctuation) keyboard character.
 
Default None.
dataFldNN n/a   IE 4   DOM n/a
 Read/Write
 

Used with IE 4 data binding to associate a remote data source column name to a text object's value property. A DATASRC attribute must also be set for the element. Setting both the dataFld and dataSrc properties to empty strings breaks the binding between element and data source.

 
Example
document.myForm.myText.dataFld = "linkURL"
 
Value
Case-sensitive identifier of the data source column.
 
Default None.
dataSrcNN n/a   IE 4   DOM n/a
 Read/Write
 

Used with IE 4 data binding to specify the name of the remote ODBC data source (such as an Oracle or SQL Server database) to be associated with the element. Content from the data source is specified via the DATAFLD attribute. Setting both the dataFld and dataSrc properties to empty strings breaks the binding between element and data source.

 
Example
document.myForm.myText.dataSrc = "#DBSRC3"
 
Value
Case-sensitive identifier of the data source.
 
Default None.
defaultValueNN 2   IE 3   DOM 1
 Read-only
 

The default text for the text input element, as established by the VALUE attribute.

 
Example
var txtObj = document.forms[0].myText
if (txtObj.value != txtObj.defaultValue ) {
    ...
}
 
Value
Any string value.
 
Default None.
disabledNN n/a   IE 4   DOM 1
 Read/Write
 

Whether the element is available for user interaction. When set to true, the element cannot receive focus or be modified by the user. It is also not submitted with the form.

 
Example
document.forms[0].myText.disabled = true
 
Value
Boolean value: true | false.
 
Default false
formNN 2   IE 3   DOM n/a
 Read-only
 

Returns a reference to the FORM element that contains the current element (if any). This property is most often passed as a parameter for an event handler, using the this keyword to refer to the current form control.

 
Example
<INPUT TYPE="text" NAME="zip"  onChange="doValidate(this.form)">
 
Value
Object reference.
 
Default None.
maxLengthNN n/a   IE 4   DOM n/a
 Read/Write
 

The maximum number of characters that may be typed into a text INPUT element. In practice, browsers beep or otherwise alert users when a typed character would exceed the maxLength value. There is no innate correlation between the maxLength and size properties. If the maxLength allows for more characters than fit within the specified width of the element, the browser provides horizontal scrolling (albeit awkward for many users) to allow entry and editing of the field.

 
Example
document.entryForm.myText.maxLength = 35
 
Value
Positive integer value.
 
Default Unlimited.
nameNN 2   IE 3   DOM 1
 Read/Write
 

The identifier associated with the form control. The value of this property is submitted as one-half of the name/value pair when the form is submitted to the server. Names are hidden from user view, since control labels are assigned via other means, depending on the control type. Form control names may also be used by script references to the objects.

 
Example
document.orderForm.myText.name = "Win32"
 
Value
Case-sensitive identifier that follows the rules of identifier naming: it may contain no whitespace, cannot begin with a numeral, and should avoid punctuation except for the underscore character.
 
Default None.
readOnlyNN n/a   IE 4   DOM n/a
 Read-only
 

Whether the form element can be edited on the page by the user. A form control whose readOnly property is true may still be modified by scripts, even though the user may not alter the content.

 
Example
document.forms[0].myText.readOnly = "true"
 
Value
Boolean value: true | false.
 
Default false
recordNumberNN n/a   IE 4   DOM n/a
 Read-only
 

Used with data binding, returns an integer representing the record within the data set that generated the element (i.e., an element whose content is filled via data binding). Values of this property can be used to extract a specific record from an Active Data Objects (ADO) record set (see recordset property).

 
Example
<SCRIPT FOR="tableTemplate" EVENT="onclick">
    myDataCollection.recordset.absoluteposition = this.recordNumber
    ...
</SCRIPT>
 
Value
Integer.
 
Default None.
sizeNN n/a   IE 4   DOM 1
 Read/Write
 

Roughly speaking, the width in characters that the input box should be sized to accommodate. In practice, the browser does not always accurately predict the proper width. See details in the SIZE attribute discussion for the INPUT element in . There is no interaction between the size and maxLength properties for this object.

 
Example
document.forms[0].myText.size = 12
 
Value
Positive integer.
 
Default 20
tabIndexNN n/a   IE 4   DOM 1
 Read/Write
 

A number that indicates the sequence of this element within the tabbing order of all focusable elements in the document. Tabbing order follows a strict set of rules. Elements that have values other than zero assigned to their tabIndex properties are first in line when a user starts tabbing in a page. Focus starts with the element with the lowest tabIndex value and proceeds in order to the highest value, regardless of physical location on the page or in the document. If two elements have the same tabIndex values, the element that comes earlier in the document receives focus first. Next come all elements that either don't support the tabIndex property or have the value set to zero. These elements receive focus in the order in which they appear in the document. A value of -1 removes the element from tabbing order altogether.

Note that the Macintosh user interface does not provide for giving focus to elements other than text and password INPUT fields.

 
Example
document.forms[0].myText.tabIndex = 6
 
Value
Integer.
 
Default None.
typeNN 3   IE 4   DOM 1
 Read-only
 

Returns the type of form control element. The value is returned in all lowercase letters. It may be necessary to cycle through all form elements in search of specific types to do some processing on (e.g., emptying all form controls of type "text" while leaving other controls untouched).

 
Example
if (document.forms[0].elements[3].type == "text") {
    ...
}
 
Value
Any of the following constants (as a string): button | checkbox | file | hidden | image | password | radio | reset | select-multiple | select-one | submit | text | textarea.
 
Default text
valueNN 2   IE 3   DOM 1
 Read/Write
 

Current value associated with the form control that is submitted with the name/value pair for the element. All values are strings, which means that scripts using text field values for some math operations (especially addition) have to convert the strings to numbers via the parseInt( ) or parseFloat( ) functions before performing the math. If you assign a number to a text field's value property, the browser automatically converts its data type to a string.

 
Example
document.forms[0].myText.value = "franken"
 
Value
String.
 
Default None.
blur( )NN 2   IE 3   DOM n/a

Removes focus from the current element and fires an onBlur event (in IE). No other element necessarily receives focus as a result.

 
Returned Value
None.
 
Parameters
None.
createTextRange( )NN n/a   IE 4   DOM n/a

Creates a TextRange object from the content of the text object. See the TextRange object for details.

 
Returned Value
TextRange object.
 
Parameters
None.
focus( )NN 2   IE 3   DOM n/a

Gives focus to the current element and fires the onFocus event (in IE). If another element had focus at the time, it receives an onBlur event.

 
Returned Value
None.
 
Parameters
None.
handleEvent( )NN 4   IE n/a   DOM n/a

handleEvent(event)

Instructs the object to accept and process the event whose specifications are passed as the parameter to the method. The object must have an event handler for the event type to process the event.

 
Returned Value
None.
 
Parameters
event A Navigator 4 event object.
select( )NN 2   IE 3   DOM n/a

Selects all the text displayed in the form element.

 
Returned Value
None.
 
Parameters
None.