PHP Class Prado\Web\UI\WebControls\TTextBox

TTextBox displays a text box on the Web page for user input. The text displayed in the TTextBox control is determined by the {@link setText Text} property. You can create a SingleLine, a MultiLine, or a Password text box by setting the {@link setTextMode TextMode} property. If the TTextBox control is a multiline text box, the number of rows it displays is determined by the {@link setRows Rows} property, and the {@link setWrap Wrap} property can be used to determine whether to wrap the text in the component. Additional {@link setTextMode TextMode} types enable the use of new input types added with html5, eg. Color, Date, Email. To specify the display width of the text box, in characters, set the {@link setColumns Columns} property. To prevent the text displayed in the component from being modified, set the {@link setReadOnly ReadOnly} property to true. If you want to limit the user input to a specified number of characters, set the {@link setMaxLength MaxLength} property. To use AutoComplete feature, set the {@link setAutoCompleteType AutoCompleteType} property. If {@link setAutoPostBack AutoPostBack} is set true, updating the text box and then changing the focus out of it will cause postback action. And if {@link setCausesValidation CausesValidation} is true, validation will also be processed, which can be further restricted within a {@link 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 {@link getSafeText SafeText} to prevent this problem. NOTE: If you set {@link setWrap Wrap} to false or use {@link setAutoCompleteType AutoCompleteType}, the generated HTML output for the textbox will not be XHTML-compatible. Currently, no alternatives are available.
Since: 3.0
Author: Qiang Xue ([email protected])
Inheritance: extends TWebControl, implements Prado\Web\UI\IPostBackDataHandler, implements Prado\Web\UI\IValidatable, implements Prado\IDataRenderer
Afficher le fichier Open project: pradosoft/prado Class Usage Examples

Méthodes publiques

Méthode Description
getAutoCompleteType ( ) : TTextBoxAutoCompleteType
getAutoPostBack ( ) : boolean
getAutoTrim ( ) : boolean
getCausesValidation ( ) : boolean
getColumns ( ) : integer
getData ( ) : string Returns the text content of the TTextBox control.
getDataChanged ( ) : boolean Returns a value indicating whether postback has caused the control data change.
getEnableClientScript ( ) : boolean
getIsValid ( ) : boolean Returns true if this control validated successfully.
getMaxLength ( ) : integer
getPersistPassword ( ) : boolean
getReadOnly ( ) : boolean
getRows ( ) : integer
getSafeText ( ) : string
getText ( ) : string
getTextMode ( ) : TTextBoxMode
getValidationGroup ( ) : string
getValidationPropertyValue ( ) : mixed Returns the value to be validated.
getWrap ( ) : boolean
loadPostData ( $key, $values ) : boolean Loads user input data.
onTextChanged ( $param ) Raises OnTextChanged event.
raisePostDataChangedEvent ( ) Raises postdata changed event.
renderBeginTag ( $writer ) Renders an additional line-break after the opening tag when it is in MultiLine text mode.
renderContents ( $writer ) Renders the body content of the textbox when it is in MultiLine text mode.
setAutoCompleteType ( $value )
setAutoPostBack ( $value ) Sets the value indicating if postback automatically.
setAutoTrim ( $value ) Sets the value indicating if the input text should be trimmed spaces
setCausesValidation ( $value )
setColumns ( $value ) Sets the display width of the text box in characters.
setData ( $value ) Sets the text content of the TTextBox control.
setEnableClientScript ( $value )
setIsValid ( $value )
setMaxLength ( $value ) Sets the maximum number of characters allowed in the text box.
setPersistPassword ( $value )
setReadOnly ( $value )
setRows ( $value ) Sets the number of rows displayed in a multiline text box.
setText ( $value ) Sets the text content of the TTextBox control.
setTextMode ( $value ) Sets the behavior mode of the TTextBox component.
setValidationGroup ( $value )
setWrap ( $value ) Sets the value indicating whether the text content wraps within a multiline text box.

Méthodes protégées

Méthode Description
addAttributesToRender ( $writer ) Adds attribute name-value pairs to renderer.
getClientClassName ( ) : string Gets the name of the javascript class responsible for performing postback for this control.
getPostBackOptions ( ) : array Gets the post back options for this textbox.
getSafeTextParser ( ) : mixed
getTagName ( ) : string
renderClientControlScript ( $writer ) Renders the javascript for textbox.

Method Details

addAttributesToRender() protected méthode

This method overrides the parent implementation with additional textbox specific attributes.
protected addAttributesToRender ( $writer )

getAutoCompleteType() public méthode

public getAutoCompleteType ( ) : TTextBoxAutoCompleteType
Résultat TTextBoxAutoCompleteType the AutoComplete type of the textbox

getAutoPostBack() public méthode

public getAutoPostBack ( ) : boolean
Résultat 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.

getAutoTrim() public méthode

public getAutoTrim ( ) : boolean
Résultat boolean a value indicating whether the input text should be trimmed spaces. Defaults to false.

getCausesValidation() public méthode

public getCausesValidation ( ) : boolean
Résultat boolean whether postback event trigger by this text box will cause input validation, default is true.

getClientClassName() protected méthode

This method overrides the parent implementation.
protected getClientClassName ( ) : string
Résultat string the javascript class name

getColumns() public méthode

public getColumns ( ) : integer
Résultat integer the display width of the text box in characters, default is 0 meaning not set.

getData() public méthode

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link getText()}.
See also: getText
Since: 3.1.0
public getData ( ) : string
Résultat string the text content of the TTextBox control.

getDataChanged() public méthode

This method is required by the \Prado\Web\UI\IPostBackDataHandler interface.
public getDataChanged ( ) : boolean
Résultat boolean whether postback has caused the control data change. False if the page is not in postback mode.

getEnableClientScript() public méthode

public getEnableClientScript ( ) : boolean
Résultat boolean whether to render javascript.

getIsValid() public méthode

Defaults to true.
public getIsValid ( ) : boolean
Résultat boolean wether this control validated successfully.

getMaxLength() public méthode

public getMaxLength ( ) : integer
Résultat integer the maximum number of characters allowed in the text box, default is 0 meaning not set.

getPersistPassword() public méthode

public getPersistPassword ( ) : boolean
Résultat boolean whether password should be displayed in the textbox during postback. Defaults to false. This property only applies when TextMode='Password'.

getPostBackOptions() protected méthode

Gets the post back options for this textbox.
protected getPostBackOptions ( ) : array
Résultat array

getReadOnly() public méthode

public getReadOnly ( ) : boolean
Résultat boolean whether the textbox is read only, default is false.

getRows() public méthode

public getRows ( ) : integer
Résultat integer the number of rows displayed in a multiline text box, default is 4

getSafeText() public méthode

public getSafeText ( ) : string
Résultat string safe text content with javascript stripped off

getSafeTextParser() protected méthode

protected getSafeTextParser ( ) : mixed
Résultat mixed safe text parser

getTagName() protected méthode

protected getTagName ( ) : string
Résultat string tag name of the textbox

getText() public méthode

public getText ( ) : string
Résultat string the text content of the TTextBox control.

getTextMode() public méthode

public getTextMode ( ) : TTextBoxMode
Résultat TTextBoxMode the behavior mode of the TTextBox component. Defaults to TTextBoxMode::SingleLine.

getValidationGroup() public méthode

public getValidationGroup ( ) : string
Résultat string the group of validators which the text box causes validation upon postback

getValidationPropertyValue() public méthode

This methid is required by \Prado\Web\UI\IValidatable interface.
public getValidationPropertyValue ( ) : mixed
Résultat mixed the value of the property to be validated.

getWrap() public méthode

public getWrap ( ) : boolean
Résultat boolean whether the text content wraps within a multiline text box. Defaults to true.

loadPostData() public méthode

This method is primarly used by framework developers.
public loadPostData ( $key, $values ) : boolean
Résultat boolean whether the data of the component has been changed

onTextChanged() public méthode

This method is invoked when the value of the {@link 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.
public onTextChanged ( $param )

raisePostDataChangedEvent() public méthode

This method is required by {@link \Prado\Web\UI\IPostBackDataHandler} interface. It is invoked by the framework when {@link getText Text} property is changed on postback. This method is primarly used by framework developers.

renderBeginTag() public méthode

Renders an additional line-break after the opening tag when it is in MultiLine text mode.
public renderBeginTag ( $writer )

renderClientControlScript() protected méthode

Renders the javascript for textbox.
protected renderClientControlScript ( $writer )

renderContents() public méthode

Renders the body content of the textbox when it is in MultiLine text mode.
public renderContents ( $writer )

setAutoCompleteType() public méthode

public setAutoCompleteType ( $value )

setAutoPostBack() public méthode

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.
public setAutoPostBack ( $value )

setAutoTrim() public méthode

Sets the value indicating if the input text should be trimmed spaces
public setAutoTrim ( $value )

setCausesValidation() public méthode

public setCausesValidation ( $value )

setColumns() public méthode

Sets the display width of the text box in characters.
public setColumns ( $value )

setData() public méthode

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link setText()}.
See also: setText
Since: 3.1.0
public setData ( $value )

setEnableClientScript() public méthode

public setEnableClientScript ( $value )

setIsValid() public méthode

public setIsValid ( $value )

setMaxLength() public méthode

Sets the maximum number of characters allowed in the text box.
public setMaxLength ( $value )

setPersistPassword() public méthode

public setPersistPassword ( $value )

setReadOnly() public méthode

public setReadOnly ( $value )

setRows() public méthode

Sets the number of rows displayed in a multiline text box.
public setRows ( $value )

setText() public méthode

Sets the text content of the TTextBox control.
public setText ( $value )

setTextMode() public méthode

Sets the behavior mode of the TTextBox component.
public setTextMode ( $value )

setValidationGroup() public méthode

public setValidationGroup ( $value )

setWrap() public méthode

Sets the value indicating whether the text content wraps within a multiline text box.
public setWrap ( $value )