TextBox

Abstract

This topic describes how to use TextBox component in SPEAK.

A TextBox control is a text box that users can enter input in. Users can enter one line of text (as opposed to the TextArea control, where users can enter multiple lines of text).

You can set a watermark or a default text that the TextBox control displays. A watermark is a non-editable text that the TextBox control displays when it is empty. You can enter a text that helps users to understand what they can enter. The watermark disappears as soon as the user enters a character, and it reappears if the user deletes all previously entered characters.

A default text is a text that the control displays, but users can change and delete this text. If you specify both a watermark and a default text, the TextBox control initially shows the default text, but if the user deletes all of this text, the watermark appears.

You can mark a TextBox control as required. Some browsers style a TextBox control that is marked as required in a different way.

If you set the Type property to “password,” the TextBox control masks user input. Most browsers replace the characters that the user types with * (asterix) characters.

Name

Description

Default

Appearance

Text

Specify a default text that the control displays. Users can edit and delete this text.

Type

Specify either text or password.

text

Watermark

Specify a text that the control shows when it has no input from the user. The text is not editable, and it is not displayed if there is any user input.

WidthPolicy

Specify how SPEAK interprets the width of the control. You can specify:

  • Default: the default width of the control is used.

  • BlockLevel: the width is set relative to the width of the container. The control fills the container horizontally.

Default.

Behavior

IsReadonly

If True, the users cannot enter text.

False

IsRequired

If True, the TextBox control is marked as being required. There is no logical effect, but some browsers style the text box differently.

False

MaxLength

Specify the maximum number of characters users can input in the TextBox control. The control does not accept any more input when the number of characters in the input reaches this number.

You can create a configuration item for a TextBox control by creating an item based on the TextBox Parameters template.

The configuration item has these specific fields:

  • Text

  • Type

  • Watermark

It inherits these fields:

  • IsEnabled

  • IsVisible

  • AccessKey

  • Tooltip

  • Behaviors

  • Id