PHP Класс 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.
С версии: 3.0
Автор: Qiang Xue ([email protected])
Наследование: extends TWebControl, implements Prado\Web\UI\IPostBackDataHandler, implements Prado\Web\UI\IValidatable, implements Prado\IDataRenderer
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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.

Описание методов

addAttributesToRender() защищенный Метод

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

getAutoCompleteType() публичный Метод

public getAutoCompleteType ( ) : TTextBoxAutoCompleteType
Результат TTextBoxAutoCompleteType the AutoComplete type of the textbox

getAutoPostBack() публичный Метод

public getAutoPostBack ( ) : boolean
Результат 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 getAutoTrim ( ) : boolean
Результат boolean a value indicating whether the input text should be trimmed spaces. Defaults to false.

getCausesValidation() публичный Метод

public getCausesValidation ( ) : boolean
Результат boolean whether postback event trigger by this text box will cause input validation, default is true.

getClientClassName() защищенный Метод

This method overrides the parent implementation.
protected getClientClassName ( ) : string
Результат string the javascript class name

getColumns() публичный Метод

public getColumns ( ) : integer
Результат integer the display width of the text box in characters, default is 0 meaning not set.

getData() публичный Метод

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link getText()}.
См. также: getText
С версии: 3.1.0
public getData ( ) : string
Результат string the text content of the TTextBox control.

getDataChanged() публичный Метод

This method is required by the \Prado\Web\UI\IPostBackDataHandler interface.
public getDataChanged ( ) : boolean
Результат boolean whether postback has caused the control data change. False if the page is not in postback mode.

getEnableClientScript() публичный Метод

public getEnableClientScript ( ) : boolean
Результат boolean whether to render javascript.

getIsValid() публичный Метод

Defaults to true.
public getIsValid ( ) : boolean
Результат boolean wether this control validated successfully.

getMaxLength() публичный Метод

public getMaxLength ( ) : integer
Результат integer the maximum number of characters allowed in the text box, default is 0 meaning not set.

getPersistPassword() публичный Метод

public getPersistPassword ( ) : boolean
Результат boolean whether password should be displayed in the textbox during postback. Defaults to false. This property only applies when TextMode='Password'.

getPostBackOptions() защищенный Метод

Gets the post back options for this textbox.
protected getPostBackOptions ( ) : array
Результат array

getReadOnly() публичный Метод

public getReadOnly ( ) : boolean
Результат boolean whether the textbox is read only, default is false.

getRows() публичный Метод

public getRows ( ) : integer
Результат integer the number of rows displayed in a multiline text box, default is 4

getSafeText() публичный Метод

public getSafeText ( ) : string
Результат string safe text content with javascript stripped off

getSafeTextParser() защищенный Метод

protected getSafeTextParser ( ) : mixed
Результат mixed safe text parser

getTagName() защищенный Метод

protected getTagName ( ) : string
Результат string tag name of the textbox

getText() публичный Метод

public getText ( ) : string
Результат string the text content of the TTextBox control.

getTextMode() публичный Метод

public getTextMode ( ) : TTextBoxMode
Результат TTextBoxMode the behavior mode of the TTextBox component. Defaults to TTextBoxMode::SingleLine.

getValidationGroup() публичный Метод

public getValidationGroup ( ) : string
Результат string the group of validators which the text box causes validation upon postback

getValidationPropertyValue() публичный Метод

This methid is required by \Prado\Web\UI\IValidatable interface.
public getValidationPropertyValue ( ) : mixed
Результат mixed the value of the property to be validated.

getWrap() публичный Метод

public getWrap ( ) : boolean
Результат boolean whether the text content wraps within a multiline text box. Defaults to true.

loadPostData() публичный Метод

This method is primarly used by framework developers.
public loadPostData ( $key, $values ) : boolean
Результат boolean whether the data of the component has been changed

onTextChanged() публичный Метод

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() публичный Метод

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() публичный Метод

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

renderClientControlScript() защищенный Метод

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

renderContents() публичный Метод

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

setAutoCompleteType() публичный Метод

public setAutoCompleteType ( $value )

setAutoPostBack() публичный Метод

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() публичный Метод

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

setCausesValidation() публичный Метод

public setCausesValidation ( $value )

setColumns() публичный Метод

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

setData() публичный Метод

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link setText()}.
См. также: setText
С версии: 3.1.0
public setData ( $value )

setEnableClientScript() публичный Метод

public setEnableClientScript ( $value )

setIsValid() публичный Метод

public setIsValid ( $value )

setMaxLength() публичный Метод

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

setPersistPassword() публичный Метод

public setPersistPassword ( $value )

setReadOnly() публичный Метод

public setReadOnly ( $value )

setRows() публичный Метод

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

setText() публичный Метод

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

setTextMode() публичный Метод

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

setValidationGroup() публичный Метод

public setValidationGroup ( $value )

setWrap() публичный Метод

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