Class TTextBox
Direct Known Sub-classes:
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.
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
|
Adds attribute name-value pairs to renderer.
|
TTextBoxAutoCompleteType
|
|
boolean
|
|
boolean
|
|
boolean
|
|
protected
string
|
Gets the name of the javascript class responsible for performing postback for this control.
|
integer
|
|
string
|
Returns the text content of the TTextBox control.
|
boolean
|
Returns a value indicating whether postback has caused the control data change.
|
boolean
|
|
bool
|
Returns true if this control validated successfully.
|
integer
|
|
boolean
|
|
protected
array
|
Gets the post back options for this textbox.
|
boolean
|
|
integer
|
|
string
|
|
protected
mixed
|
|
protected
string
|
|
string
|
|
TTextBoxMode
|
|
string
|
|
mixed
|
Returns the value to be validated.
|
boolean
|
|
boolean
|
Loads user input data.
|
void
|
Raises OnTextChanged event.
|
void
|
Raises postdata changed event.
|
protected
void
|
Renders the javascript for textbox.
|
void
|
Renders the body content of the textbox when it is in MultiLine text mode.
|
void
|
|
void
|
Sets the value indicating if postback automatically.
|
void
|
Sets the value indicating if the input text should be trimmed spaces
|
void
|
|
void
|
Sets the display width of the text box in characters.
|
void
|
Sets the text content of the TTextBox control.
|
void
|
|
void
|
|
void
|
Sets the maximum number of characters allowed in the text box.
|
void
|
|
void
|
|
void
|
Sets the number of rows displayed in a multiline text box.
|
void
|
Sets the text content of the TTextBox control.
|
void
|
Sets the behavior mode of the TTextBox component.
|
void
|
|
void
|
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 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
|
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
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.
|
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
Output |
string
| the text content of the TTextBox control. |
Exception |
|
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
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.
|
renderClientControlScript
protected void renderClientControlScript |
(mixed $writer ) |
Renders the javascript for textbox.
Input |
mixed | $writer | |
Output |
Exception |
|
renderContents
Renders the body content of the textbox when it is in MultiLine text mode.
Input |
THtmlWriter | $writer | the writer for rendering |
Output |
Exception |
|
setAutoCompleteType
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
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)
|
DEFAULT_ROWS
Default number of rows (for MultiLine text box)
|
|