- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml
Classes:
IDataSource
IItemDataRenderer
IRepeatInfoUser
TActiveFileUpload
TBaseDataList
TBaseValidator
TBoundColumn
TBulletedList
TBulletedListDisplayMode
TBulletedListEventParameter
TBulletStyle
TButton
TButtonColumn
TButtonColumnType
TButtonType
TCaptcha
TCaptchaValidator
TCheckBox
TCheckBoxColumn
TCheckBoxList
TCircleHotSpot
TClientScript
TClientScriptLoader
TClientSideValidationSummaryOptions
TColorPicker
TColorPickerClientSide
TColorPickerMode
TCompareValidator
TCompleteWizardStep
TConditional
TContent
TContentDirection
TContentPlaceHolder
TCustomValidator
TDataBoundControl
TDataGrid
TDataGridColumn
TDataGridColumnCollection
TDataGridCommandEventParameter
TDataGridItem
TDataGridItemCollection
TDataGridItemEventParameter
TDataGridItemRenderer
TDataGridPageChangedEventParameter
TDataGridPager
TDataGridPagerButtonType
TDataGridPagerEventParameter
TDataGridPagerMode
TDataGridPagerPosition
TDataGridPagerStyle
TDataGridSortCommandEventParameter
TDataList
TDataListCommandEventParameter
TDataListItem
TDataListItemCollection
TDataListItemEventParameter
TDataListItemRenderer
TDataRenderer
TDataSourceControl
TDataSourceSelectParameters
TDataSourceView
TDataTypeValidator
TDatePicker
TDatePickerClientScript
TDatePickerInputMode
TDatePickerMode
TDatePickerPositionMode
TDisplayStyle
TDraggable
TDropContainer
TDropDownList
TDropDownListColumn
TEditCommandColumn
TEmailAddressValidator
TExpression
TFileUpload
TFont
THiddenField
THorizontalAlign
THotSpot
THotSpotCollection
THotSpotMode
THtmlArea
THtmlElement
THyperLink
THyperLinkColumn
TImage
TImageButton
TImageClickEventParameter
TImageMap
TImageMapEventParameter
TInlineFrame
TInlineFrameAlign
TInlineFrameScrollBars
TItemDataRenderer
TJavascriptLogger
TKeyboard
TLabel
TLinkButton
TListBox
TListControl
TListControlValidator
TListItem
TListItemCollection
TListItemType
TListSelectionMode
TLiteral
TLiteralColumn
TMarkdown
TMetaTag
TMetaTagCollection
TMultiView
TOutputCache
TOutputCacheCalculateKeyEventParameter
TOutputCacheCheckDependencyEventParameter
TPager
TPagerButtonType
TPagerMode
TPagerPageChangedEventParameter
TPanel
TPanelStyle
TPlaceHolder
TPolygonHotSpot
TRadioButton
TRadioButtonList
TRangeValidationDataType
TRangeValidator
TRatingList
TReadOnlyDataSource
TReadOnlyDataSourceView
TRectangleHotSpot
TRegularExpressionValidator
TRepeatDirection
TRepeater
TRepeaterCommandEventParameter
TRepeaterItem
TRepeaterItemCollection
TRepeaterItemEventParameter
TRepeaterItemRenderer
TRepeatInfo
TRepeatLayout
TRequiredFieldValidator
TSafeHtml
TScrollBars
TServerValidateEventParameter
TSlider
TSliderClientScript
TSliderDirection
TStatements
TStyle
TStyleSheet
TTable
TTableCaptionAlign
TTableCell
TTableCellCollection
TTableFooterRow
TTableGridLines
TTableHeaderCell
TTableHeaderRow
TTableHeaderScope
TTableItemStyle
TTableRow
TTableRowCollection
TTableRowSection
TTableStyle
TTabPanel
TTabView
TTabViewCollection
TTemplateColumn
TTemplatedWizardStep
TTextAlign
TTextBox
TTextBoxAutoCompleteType
TTextBoxMode
TTextHighlighter
TTextHighlighterLineNumberStyle
TValidationCompareOperator
TValidationDataType
TValidationSummary
TValidationSummaryDisplayMode
TValidationSummaryDisplayStyle
TValidatorClientSide
TValidatorDisplayStyle
TVerticalAlign
TView
TViewCollection
TWebControl
TWebControlAdapter
TWizard
TWizardFinishNavigationTemplate
TWizardNavigationButtonStyle
TWizardNavigationButtonType
TWizardNavigationContainer
TWizardNavigationEventParameter
TWizardNavigationTemplate
TWizardSideBarListItemTemplate
TWizardSideBarTemplate
TWizardStartNavigationTemplate
TWizardStep
TWizardStepCollection
TWizardStepNavigationTemplate
TWizardStepType
TXmlTransform

Keyword

# Class TTextBox

    TComponent
       |
       --TApplicationComponent
          |
          --TControl
             |
             --TWebControl
                |
                --TTextBox

#### Direct Known Sub-classes:

TActiveTextBox , TColorPicker , TDatePicker , THtmlArea

TTextBox class

TTextBox displays a text box on the Web page for user input. The text displayed in the TTextBox control is determined by the Text property. You can create a SingleLine, a MultiLine, or a Password text box by setting the TextMode property. If the TTextBox control is a multiline text box, the number of rows it displays is determined by the Rows property, and the Wrap property can be used to determine whether to wrap the text in the component.

To specify the display width of the text box, in characters, set the Columns property. To prevent the text displayed in the component from being modified, set the ReadOnly property to true. If you want to limit the user input to a specified number of characters, set the MaxLength property. To use AutoComplete feature, set the AutoCompleteType property.

If AutoPostBack is set true, updating the text box and then changing the focus out of it will cause postback action. And if CausesValidation is true, validation will also be processed, which can be further restricted within a ValidationGroup.

WARNING: Be careful if you want to display the text collected via TTextBox. Malicious cross-site script may be injected in. You may use SafeText to prevent this problem.

NOTE: If you set Wrap to false or use AutoCompleteType, the generated HTML output for the textbox will not be XHTML-compatible. Currently, no alternatives are available.

Since: 3.0
Author: Qiang Xue <qiang.xue@gmail.com>

Constants Inherited From TControl

AUTOMATIC_ID_PREFIX, CLIENT_ID_SEPARATOR, CS_CHILD_INITIALIZED, CS_CONSTRUCTED, CS_INITIALIZED, CS_LOADED, CS_PRERENDERED, CS_STATE_LOADED, ID_FORMAT, ID_SEPARATOR, IS_CHILD_CREATED, IS_CREATING_CHILD, IS_DISABLE_THEMING, IS_DISABLE_VIEWSTATE, IS_ID_SET, IS_SKIN_APPLIED, IS_STYLESHEET_APPLIED, RF_ADAPTER, RF_AUTO_BINDINGS, RF_CHILD_STATE, RF_CONTROLS, RF_CONTROLSTATE, RF_DATA_BINDINGS, RF_EVENTS, RF_NAMED_CONTROLS, RF_NAMED_CONTROLS_ID, RF_NAMED_OBJECTS, RF_SKIN_ID,

Method Summary
protected void | addAttributesToRender ( THtmlWriter $writer) Adds attribute name-value pairs to renderer.
TTextBoxAutoCompleteType | getAutoCompleteType ()
boolean | getAutoPostBack ()
boolean | getAutoTrim ()
boolean | getCausesValidation ()
protected string | getClientClassName () Gets the name of the javascript class responsible for performing postback for this control.
integer | getColumns ()
string | getData () Returns the text content of the TTextBox control.
boolean | getDataChanged () Returns a value indicating whether postback has caused the control data change.
boolean | getEnableClientScript ()
bool | getIsValid () Returns true if this control validated successfully.
integer | getMaxLength ()
boolean | getPersistPassword ()
protected array | getPostBackOptions () Gets the post back options for this textbox.
boolean | getReadOnly ()
integer | getRows ()
string | getSafeText ()
protected mixed | getSafeTextParser ()
protected string | getTagName ()
string | getText ()
TTextBoxMode | getTextMode ()
string | getValidationGroup ()
mixed | getValidationPropertyValue () Returns the value to be validated.
boolean | getWrap ()
boolean | loadPostData ( string $key, array $values) Loads user input data.
void | onTextChanged ( TEventParameter $param) Raises OnTextChanged event.
void | raisePostDataChangedEvent () Raises postdata changed event.
protected void | renderClientControlScript ( mixed $writer) Renders the javascript for textbox.
void | renderContents ( THtmlWriter $writer) Renders the body content of the textbox when it is in MultiLine text mode.
void | setAutoCompleteType ( TTextBoxAutoCompleteType $value)
void | setAutoPostBack ( boolean $value) Sets the value indicating if postback automatically.
void | setAutoTrim ( boolean $value) Sets the value indicating if the input text should be trimmed spaces
void | setCausesValidation ( boolean $value)
void | setColumns ( integer $value) Sets the display width of the text box in characters.
void | setData ( string $value) Sets the text content of the TTextBox control.
void | setEnableClientScript ( boolean $value)
void | setIsValid ( bool $value)
void | setMaxLength ( integer $value) Sets the maximum number of characters allowed in the text box.
void | setPersistPassword ( boolean $value)
void | setReadOnly ( boolean $value)
void | setRows ( integer $value) Sets the number of rows displayed in a multiline text box.
void | setText ( string $value) Sets the text content of the TTextBox control.
void | setTextMode ( TTextBoxMode $value) Sets the behavior mode of the TTextBox component.
void | setValidationGroup ( string $value)
void | setWrap ( boolean $value) Sets the value indicating whether the text content wraps within a multiline text box.

Methods Inherited From TWebControl

TWebControl::addAttributesToRender(), TWebControl::clearStyle(), TWebControl::copyBaseAttributes(), TWebControl::createStyle(), TWebControl::getAccessKey(), TWebControl::getBackColor(), TWebControl::getBorderColor(), TWebControl::getBorderStyle(), TWebControl::getBorderWidth(), TWebControl::getCssClass(), TWebControl::getDisplay(), TWebControl::getFont(), TWebControl::getForeColor(), TWebControl::getHasStyle(), TWebControl::getHeight(), TWebControl::getStyle(), TWebControl::getTabIndex(), TWebControl::getTagName(), TWebControl::getToolTip(), TWebControl::getWidth(), TWebControl::render(), TWebControl::renderBeginTag(), TWebControl::renderContents(), TWebControl::renderEndTag(), TWebControl::setAccessKey(), TWebControl::setBackColor(), TWebControl::setBorderColor(), TWebControl::setBorderStyle(), TWebControl::setBorderWidth(), TWebControl::setCssClass(), TWebControl::setDisplay(), TWebControl::setForeColor(), TWebControl::setHeight(), TWebControl::setStyle(), TWebControl::setTabIndex(), TWebControl::setToolTip(), TWebControl::setWidth()

Methods Inherited From TControl

TControl::addedControl(), TControl::addParsedObject(), TControl::addToPostDataLoader(), TControl::applyStyleSheetSkin(), TControl::autoBindProperty(), TControl::autoDataBindProperties(), TControl::bindProperty(), TControl::broadcastEvent(), TControl::bubbleEvent(), TControl::clearChildState(), TControl::clearControlState(), TControl::clearNamingContainer(), TControl::clearViewState(), TControl::convertUniqueIdToClientId(), TControl::createChildControls(), TControl::createControlCollection(), TControl::dataBind(), TControl::dataBindChildren(), TControl::dataBindProperties(), TControl::ensureChildControls(), TControl::findControl(), TControl::findControlsByID(), TControl::findControlsByType(), TControl::focus(), TControl::getAdapter(), TControl::getAllowChildControls(), TControl::getAttribute(), TControl::getAttributes(), TControl::getChildControlsCreated(), TControl::getClientID(), TControl::getControls(), TControl::getControlStage(), TControl::getControlState(), TControl::getCustomData(), TControl::getEnabled(), TControl::getEnableTheming(), TControl::getEnableViewState(), TControl::getHasAdapter(), TControl::getHasAttributes(), TControl::getHasChildInitialized(), TControl::getHasControls(), TControl::getHasInitialized(), TControl::getHasLoaded(), TControl::getHasLoadedPostData(), TControl::getHasPreRendered(), TControl::getID(), TControl::getNamingContainer(), TControl::getPage(), TControl::getParent(), TControl::getRegisteredObject(), TControl::getSkinID(), TControl::getSourceTemplateControl(), TControl::getTemplateControl(), TControl::getUniqueID(), TControl::getViewState(), TControl::getVisible(), TControl::hasAttribute(), TControl::initRecursive(), TControl::isDescendentOf(), TControl::isObjectRegistered(), TControl::loadRecursive(), TControl::loadState(), TControl::loadStateRecursive(), TControl::onDataBinding(), TControl::onInit(), TControl::onLoad(), TControl::onPreRender(), TControl::onUnload(), TControl::preRenderRecursive(), TControl::raiseBubbleEvent(), TControl::registerObject(), TControl::removeAttribute(), TControl::removedControl(), TControl::render(), TControl::renderChildren(), TControl::renderControl(), TControl::saveState(), TControl::saveStateRecursive(), TControl::setAdapter(), TControl::setAttribute(), TControl::setChildControlsCreated(), TControl::setControlStage(), TControl::setControlState(), TControl::setCustomData(), TControl::setEnabled(), TControl::setEnableTheming(), TControl::setEnableViewState(), TControl::setID(), TControl::setPage(), TControl::setSkinID(), TControl::setTemplateControl(), TControl::setViewState(), TControl::setVisible(), TControl::trackViewState(), TControl::traverseChildControls(), TControl::unbindProperty(), TControl::unloadRecursive(), TControl::unregisterObject(), TControl::__get()

Methods Inherited From TApplicationComponent
TApplicationComponent::getApplication(), TApplicationComponent::getRequest(), TApplicationComponent::getResponse(), TApplicationComponent::getService(), TApplicationComponent::getSession(), TApplicationComponent::getUser(), TApplicationComponent::publishAsset(), TApplicationComponent::publishFilePath()

Methods Inherited From TComponent

TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()

Constant Summary
int | DEFAULT_COLUMNS | Default number of columns (for MultiLine text box)
int | DEFAULT_ROWS | Default number of rows (for MultiLine text box)

Method Details

## addAttributesToRender

protected void addAttributesToRender | (THtmlWriter $writer )

Adds attribute name-value pairs to renderer.

This method overrides the parent implementation with additional textbox specific attributes.

Input
THtmlWriter | $writer | the writer used for the rendering purpose
Output
Exception

## getAutoCompleteType

public TTextBoxAutoCompleteType getAutoCompleteType | ()

Output
TTextBoxAutoCompleteType | the AutoComplete type of the textbox
Exception

## getAutoPostBack

public boolean getAutoPostBack | ()

Output
boolean | a value indicating whether an automatic postback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to false.
Exception

## getAutoTrim

public boolean getAutoTrim | ()

Output
boolean | a value indicating whether the input text should be trimmed spaces. Defaults to false.
Exception

## getCausesValidation

public boolean getCausesValidation | ()

Output
boolean | whether postback event trigger by this text box will cause input validation, default is true.
Exception

## getClientClassName

protected string getClientClassName | ()

Gets the name of the javascript class responsible for performing postback for this control.

This method overrides the parent implementation.

Output
string | the javascript class name
Exception

## getColumns

public integer getColumns | ()

Output
integer | the display width of the text box in characters, default is 0 meaning not set.
Exception

## getData

public string getData | ()

Returns the text content of the TTextBox control.

This method is required by IDataRenderer. It is the same as getText().

Output
string | the text content of the TTextBox control.
Exception

## getDataChanged

public boolean getDataChanged | ()

Returns a value indicating whether postback has caused the control data change.

This method is required by the IPostBackDataHandler interface.

Output
boolean | whether postback has caused the control data change. False if the page is not in postback mode.
Exception

## getEnableClientScript

public boolean getEnableClientScript | ()

Output
boolean | whether to render javascript.
Exception

## getIsValid

public bool getIsValid | ()

Returns true if this control validated successfully.

Defaults to true.

Output
bool | wether this control validated successfully.
Exception

## getMaxLength

public integer getMaxLength | ()

Output
integer | the maximum number of characters allowed in the text box, default is 0 meaning not set.
Exception

## getPersistPassword

public boolean getPersistPassword | ()

Output
boolean | whether password should be displayed in the textbox during postback. Defaults to false. This property only applies when TextMode='Password'.
Exception

## getPostBackOptions

protected array getPostBackOptions | ()

Gets the post back options for this textbox.

Output
Exception

## getReadOnly

public boolean getReadOnly | ()

Output
boolean | whether the textbox is read only, default is false.
Exception

## getRows

public integer getRows | ()

Output
integer | the number of rows displayed in a multiline text box, default is 4
Exception

## getSafeText

public string getSafeText | ()

Output
string | safe text content with javascript stripped off
Exception

## getSafeTextParser

protected mixed getSafeTextParser | ()

Output
mixed | safe text parser
Exception

## getTagName

protected string getTagName | ()

Output
string | tag name of the textbox
Exception

## getText

public string getText | ()

Output
string | the text content of the TTextBox control.
Exception

## getTextMode

public TTextBoxMode getTextMode | ()

Output
TTextBoxMode | the behavior mode of the TTextBox component. Defaults to TTextBoxMode::SingleLine.
Exception

## getValidationGroup

public string getValidationGroup | ()

Output
string | the group of validators which the text box causes validation upon postback
Exception

## getValidationPropertyValue

public mixed getValidationPropertyValue | ()

Returns the value to be validated.

This methid is required by IValidatable interface.

Output
mixed | the value of the property to be validated.
Exception

## getWrap

public boolean getWrap | ()

Output
boolean | whether the text content wraps within a multiline text box. Defaults to true.
Exception

## loadPostData

public boolean loadPostData | (string $key , array $values )

Loads user input data.

This method is primarly used by framework developers.

Input
string | $key | the key that can be used to retrieve data from the input data collection
array | $values | the input data collection
Output
boolean | whether the data of the component has been changed
Exception

## onTextChanged

public void onTextChanged | (TEventParameter $param )

Raises OnTextChanged event.

This method is invoked when the value of the Text property changes on postback. If you override this method, be sure to call the parent implementation to ensure the invocation of the attached event handlers.

Input
TEventParameter | $param | event parameter to be passed to the event handlers
Output
Exception

## raisePostDataChangedEvent

public void raisePostDataChangedEvent | ()

Raises postdata changed event.

This method is required by IPostBackDataHandler interface. It is invoked by the framework when Text property is changed on postback. This method is primarly used by framework developers.

Output
Exception

## renderClientControlScript

protected void renderClientControlScript | (mixed $writer )

Renders the javascript for textbox.

Input
mixed | $writer |
Output
Exception

## renderContents

public void renderContents | (THtmlWriter $writer )

Renders the body content of the textbox when it is in MultiLine text mode.

Input
THtmlWriter | $writer | the writer for rendering
Output
Exception

## setAutoCompleteType

public void setAutoCompleteType | (TTextBoxAutoCompleteType $value )

Input
TTextBoxAutoCompleteType | $value | the AutoComplete type of the textbox, default value is TTextBoxAutoCompleteType::None.
Output
Exception
throws | TInvalidDataValueException if the input parameter is not a valid AutoComplete type

## setAutoPostBack

public void setAutoPostBack | (boolean $value )

Sets the value indicating if postback automatically.

An automatic postback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component.

Input
boolean | $value | the value indicating if postback automatically
Output
Exception

## setAutoTrim

public void setAutoTrim | (boolean $value )

Sets the value indicating if the input text should be trimmed spaces

Input
boolean | $value | the value indicating if the input text should be trimmed spaces
Output
Exception

## setCausesValidation

public void setCausesValidation | (boolean $value )

Input
boolean | $value | whether postback event trigger by this text box will cause input validation.
Output
Exception

## setColumns

public void setColumns | (integer $value )

Sets the display width of the text box in characters.

Input
integer | $value | the display width, set it 0 to clear the setting
Output
Exception

## setData

public void setData | (string $value )

Sets the text content of the TTextBox control.

This method is required by IDataRenderer. It is the same as setText().

Input
string | $value | the text content of the TTextBox control.
Output
Exception

## setEnableClientScript

public void setEnableClientScript | (boolean $value )

Input
boolean | $value | whether to render javascript.
Output
Exception

## setIsValid

public void setIsValid | (bool $value )

Input
bool | $value | wether this control is valid.
Output
Exception

## setMaxLength

public void setMaxLength | (integer $value )

Sets the maximum number of characters allowed in the text box.

Input
integer | $value | the maximum length, set it 0 to clear the setting
Output
Exception

## setPersistPassword

public void setPersistPassword | (boolean $value )

Input
boolean | $value | whether password should be displayed in the textbox during postback. This property only applies when TextMode='Password'.
Output
Exception

## setReadOnly

public void setReadOnly | (boolean $value )

Input
boolean | $value | whether the textbox is read only
Output
Exception

## setRows

public void setRows | (integer $value )

Sets the number of rows displayed in a multiline text box.

Input
integer | $value | the number of rows
Output
Exception

## setText

public void setText | (string $value )

Sets the text content of the TTextBox control.

Input
string | $value | the text content
Output
Exception

## setTextMode

public void setTextMode | (TTextBoxMode $value )

Sets the behavior mode of the TTextBox component.

Input
TTextBoxMode | $value | the text mode
Output
Exception
throws | TInvalidDataValueException if the input value is not a valid text mode.

## setValidationGroup

public void setValidationGroup | (string $value )

Input
string | $value | the group of validators which the text box causes validation upon postback
Output
Exception

## setWrap

public void setWrap | (boolean $value )

Sets the value indicating whether the text content wraps within a multiline text box.

Input
boolean | $value | whether the text content wraps within a multiline text box.
Output
Exception

Constant Details

### DEFAULT_COLUMNS

Default number of columns (for MultiLine text box)

#### Type:

int

#### Value:

20

### DEFAULT_ROWS

Default number of rows (for MultiLine text box)

#### Type:

int

#### Value:

4