|
Class TTextBox
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 setText Text
property. You can create a SingleLine, a MultiLine, or a
Password text box by setting the setTextMode TextMode property.
If the TTextBox control is a multiline text box, the number of rows it displays
is determined by the setRows Rows property, and the setWrap 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 setColumns Columns property. To prevent the text displayed in the component
from being modified, set the setReadOnly ReadOnly property to true. If
you want to limit the user input to a specified number of characters, set the
setMaxLength MaxLength property. To use AutoComplete feature, set the
setAutoCompleteType AutoCompleteType property.
If setAutoPostBack AutoPostBack is set true, updating the text box
and then changing the focus out of it will cause postback action. And if setCausesValidation CausesValidation is true, validation will also be
processed, which can be further restricted within a setValidationGroup
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 getSafeText
SafeText to prevent this problem.
NOTE: If you set setWrap Wrap to false or use setAutoCompleteType AutoCompleteType, the generated HTML output for the textbox
will not be XHTML-compatible. Currently, no alternatives are available.
-
TComponent
-
TApplicationComponent
-
TControl
implements
IRenderable,
IBindable
-
TWebControl
implements
IStyleable
-
TTextBox
implements
IPostBackDataHandler,
IValidatable,
IDataRenderer
Methods summary
protected
string
|
#
getTagName( )
Returns
string tag name of the textbox
Overrides
|
public
boolean
|
#
getEnableClientScript( )
Returns
boolean whether to render javascript.
|
public
|
#
setEnableClientScript( boolean $value )
Parameters
- $value
boolean whether to render javascript.
|
protected
|
#
addAttributesToRender( THtmlWriter $writer )
Adds attribute name-value pairs to renderer. This method overrides the parent
implementation with additional textbox specific attributes.
Adds attribute name-value pairs to renderer. This method overrides the parent
implementation with additional textbox specific attributes.
Parameters
- $writer
THtmlWriter
the writer used for the rendering purpose
Overrides
|
protected
|
#
renderClientControlScript( mixed $writer )
Renders the javascript for textbox.
Renders the javascript for textbox.
|
protected
string
|
#
getClientClassName( )
Gets the name of the javascript class responsible for performing postback for
this control. This method overrides the parent implementation.
Gets the name of the javascript class responsible for performing postback for
this control. This method overrides the parent implementation.
Returns
string the javascript class name
|
protected
array
|
#
getPostBackOptions( )
Gets the post back options for this textbox.
Gets the post back options for this textbox.
Returns
array
|
public
boolean
|
#
loadPostData( string $key, array $values )
Loads user input data. This method is primarly used by framework
developers.
Loads user input data. This method is primarly used by framework
developers.
Parameters
- $key
string the key that can be used to retrieve data from the input data collection
- $values
array the input data collection
Returns
boolean whether the data of the component has been changed
Implementation of
|
public
boolean
|
#
getDataChanged( )
Returns a value indicating whether postback has caused the control data
change. This method is required by the IPostBackDataHandler interface.
Returns a value indicating whether postback has caused the control data
change. This method is required by the IPostBackDataHandler interface.
Returns
boolean whether postback has caused the control data change. False if the page is not in
postback mode.
Implementation of
|
public
mixed
|
#
getValidationPropertyValue( )
Returns the value to be validated. This methid is required by IValidatable
interface.
Returns the value to be validated. This methid is required by IValidatable
interface.
Returns
mixed the value of the property to be validated.
Implementation of
|
public
boolean
|
#
getIsValid( )
Returns true if this control validated successfully. Defaults to true.
Returns true if this control validated successfully. Defaults to true.
Returns
boolean wether this control validated successfully.
Implementation of
|
public
boolean
|
#
setIsValid( boolean $value )
Parameters
- $value
boolean wether this control is valid.
Returns
boolean wether this control's validators validated successfully
Implementation of
|
public
|
#
onTextChanged( TEventParameter $param )
Raises OnTextChanged event. This method is invoked when the value of
the getText 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.
Raises OnTextChanged event. This method is invoked when the value of
the getText 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.
Parameters
|
public
|
#
raisePostDataChangedEvent( )
Raises postdata changed event. This method is required by IPostBackDataHandler interface. It is invoked by the framework when getText Text property is changed on postback. This method is primarly used by
framework developers.
Raises postdata changed event. This method is required by IPostBackDataHandler interface. It is invoked by the framework when getText Text property is changed on postback. This method is primarly used by
framework developers.
Implementation of
|
public
|
#
renderContents( THtmlWriter $writer )
Renders the body content of the textbox when it is in MultiLine text
mode.
Renders the body content of the textbox when it is in MultiLine text
mode.
Parameters
Overrides
|
public
|
#
renderBeginTag( THtmlWriter $writer )
Renders an additional line-break after the opening tag when it is in
MultiLine text mode.
Renders an additional line-break after the opening tag when it is in
MultiLine text mode.
Parameters
- $writer
THtmlWriter
the writer used for the rendering purpose^M
Overrides
|
public
TTextBoxAutoCompleteType
|
|
public
|
|
public
boolean
|
#
getAutoPostBack( )
Returns
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.
|
public
|
#
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.
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.
Parameters
- $value
boolean the value indicating if postback automatically
|
public
boolean
|
#
getAutoTrim( )
Returns
boolean a value indicating whether the input text should be trimmed spaces. Defaults to
false.
|
public
|
#
setAutoTrim( boolean $value )
Sets the value indicating if the input text should be trimmed spaces
Sets the value indicating if the input text should be trimmed spaces
Parameters
- $value
boolean the value indicating if the input text should be trimmed spaces
|
public
boolean
|
#
getCausesValidation( )
Returns
boolean whether postback event trigger by this text box will cause input validation,
default is true.
|
public
|
#
setCausesValidation( boolean $value )
Parameters
- $value
boolean whether postback event trigger by this text box will cause input validation.
|
public
integer
|
#
getColumns( )
Returns
integer the display width of the text box in characters, default is 0 meaning not set.
|
public
|
#
setColumns( integer $value )
Sets the display width of the text box in characters.
Sets the display width of the text box in characters.
Parameters
- $value
integer the display width, set it 0 to clear the setting
|
public
integer
|
#
getMaxLength( )
Returns
integer the maximum number of characters allowed in the text box, default is 0 meaning
not set.
|
public
|
#
setMaxLength( integer $value )
Sets the maximum number of characters allowed in the text box.
Sets the maximum number of characters allowed in the text box.
Parameters
- $value
integer the maximum length, set it 0 to clear the setting
|
public
boolean
|
#
getReadOnly( )
Returns
boolean whether the textbox is read only, default is false.
|
public
|
#
setReadOnly( boolean $value )
Parameters
- $value
boolean whether the textbox is read only
|
public
integer
|
#
getRows( )
Returns
integer the number of rows displayed in a multiline text box, default is 4
|
public
|
#
setRows( integer $value )
Sets the number of rows displayed in a multiline text box.
Sets the number of rows displayed in a multiline text box.
Parameters
- $value
integer the number of rows
|
public
boolean
|
#
getPersistPassword( )
Returns
boolean whether password should be displayed in the textbox during postback. Defaults to
false. This property only applies when TextMode='Password'.
|
public
|
#
setPersistPassword( boolean $value )
Parameters
- $value
boolean whether password should be displayed in the textbox during postback. This
property only applies when TextMode='Password'.
|
public
string
|
#
getText( )
Returns
string the text content of the TTextBox control.
|
public
|
#
setText( string $value )
Sets the text content of the TTextBox control.
Sets the text content of the TTextBox control.
Parameters
- $value
string the text content
|
public
string
|
#
getData( )
Returns the text content of the TTextBox control. This method is required by
IDataRenderer . It is the same as TTextBox::getText() .
Returns
string the text content of the TTextBox control.
Since
3.1.0
See
Implementation of
|
public
|
#
setData( string $value )
Sets the text content of the TTextBox control. This method is required by
IDataRenderer . It is the same as TTextBox::setText() .
Parameters
- $value
string the text content of the TTextBox control.
Since
3.1.0
See
Implementation of
|
public
string
|
#
getSafeText( )
Returns
string safe text content with javascript stripped off
|
protected
mixed
|
#
getSafeTextParser( )
Returns
mixed safe text parser
|
public
TTextBoxMode
|
#
getTextMode( )
Returns
TTextBoxMode
the behavior mode of the TTextBox component. Defaults to
TTextBoxMode::SingleLine.
|
public
|
#
setTextMode( TTextBoxMode $value )
Sets the behavior mode of the TTextBox component.
Sets the behavior mode of the TTextBox component.
Parameters
Throws
|
public
string
|
#
getValidationGroup( )
Returns
string the group of validators which the text box causes validation upon postback
|
public
|
#
setValidationGroup( string $value )
Parameters
- $value
string the group of validators which the text box causes validation upon postback
|
public
boolean
|
#
getWrap( )
Returns
boolean whether the text content wraps within a multiline text box. Defaults to true.
|
public
|
#
setWrap( boolean $value )
Sets the value indicating whether the text content wraps within a multiline
text box.
Sets the value indicating whether the text content wraps within a multiline
text box.
Parameters
- $value
boolean whether the text content wraps within a multiline text box.
|
Methods inherited from TWebControl
clearStyle(),
copyBaseAttributes(),
createStyle(),
getAccessKey(),
getBackColor(),
getBorderColor(),
getBorderStyle(),
getBorderWidth(),
getCssClass(),
getDecorator(),
getDisplay(),
getEnsureId(),
getFont(),
getForeColor(),
getHasStyle(),
getHeight(),
getStyle(),
getTabIndex(),
getToolTip(),
getWidth(),
onPreRender(),
render(),
renderEndTag(),
setAccessKey(),
setBackColor(),
setBorderColor(),
setBorderStyle(),
setBorderWidth(),
setCssClass(),
setDisplay(),
setEnsureId(),
setForeColor(),
setHeight(),
setStyle(),
setTabIndex(),
setToolTip(),
setWidth()
|
Methods inherited from TControl
__construct(),
__get(),
addParsedObject(),
addToPostDataLoader(),
addedControl(),
applyStyleSheetSkin(),
autoBindProperty(),
autoDataBindProperties(),
bindProperty(),
broadcastEvent(),
bubbleEvent(),
clearChildState(),
clearControlState(),
clearNamingContainer(),
clearViewState(),
convertUniqueIdToClientId(),
createChildControls(),
createControlCollection(),
dataBind(),
dataBindChildren(),
dataBindProperties(),
ensureChildControls(),
findControl(),
findControlsByID(),
findControlsByType(),
focus(),
getAdapter(),
getAllowChildControls(),
getAttribute(),
getAttributes(),
getChildControlsCreated(),
getClientID(),
getControlStage(),
getControlState(),
getControls(),
getCustomData(),
getEnableTheming(),
getEnableViewState(),
getEnabled(),
getHasAdapter(),
getHasAttributes(),
getHasChildInitialized(),
getHasControls(),
getHasInitialized(),
getHasLoaded(),
getHasLoadedPostData(),
getHasPreRendered(),
getID(),
getIsSkinApplied(),
getNamingContainer(),
getPage(),
getParent(),
getRegisteredObject(),
getSkinID(),
getSourceTemplateControl(),
getTemplateControl(),
getUniqueID(),
getViewState(),
getVisible(),
hasAttribute(),
initRecursive(),
isDescendentOf(),
isObjectRegistered(),
loadRecursive(),
loadState(),
loadStateRecursive(),
onDataBinding(),
onInit(),
onLoad(),
onUnload(),
preRenderRecursive(),
raiseBubbleEvent(),
registerObject(),
removeAttribute(),
removedControl(),
renderChildren(),
renderControl(),
saveState(),
saveStateRecursive(),
setAdapter(),
setAttribute(),
setChildControlsCreated(),
setControlStage(),
setControlState(),
setCustomData(),
setEnableTheming(),
setEnableViewState(),
setEnabled(),
setID(),
setPage(),
setSkinID(),
setTemplateControl(),
setViewState(),
setVisible(),
trackViewState(),
traverseChildControls(),
unbindProperty(),
unloadRecursive(),
unregisterObject()
|
Methods inherited from TComponent
__call(),
__destruct(),
__isset(),
__set(),
__sleep(),
__unset(),
__wakeup(),
asa(),
attachBehavior(),
attachBehaviors(),
attachClassBehavior(),
attachEventHandler(),
canGetProperty(),
canSetProperty(),
clearBehaviors(),
createdOnTemplate(),
detachBehavior(),
detachBehaviors(),
detachClassBehavior(),
detachEventHandler(),
disableBehavior(),
disableBehaviors(),
enableBehavior(),
enableBehaviors(),
evaluateExpression(),
evaluateStatements(),
fxAttachClassBehavior(),
fxDetachClassBehavior(),
getAutoGlobalListen(),
getBehaviorsEnabled(),
getClassHierarchy(),
getEventHandlers(),
getListeningToGlobalEvents(),
getSubProperty(),
hasEvent(),
hasEventHandler(),
hasProperty(),
isa(),
listen(),
raiseEvent(),
setSubProperty(),
unlisten()
|
Constants summary
integer |
DEFAULT_ROWS |
4 |
#
Default number of rows (for MultiLine text box)
Default number of rows (for MultiLine text box)
|
integer |
DEFAULT_COLUMNS |
20 |
#
Default number of columns (for MultiLine text box)
Default number of columns (for MultiLine text box)
|
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
|
|