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 \Prado\Web\UI\WebControls\setText property. You can create a SingleLine, a MultiLine, or a Password text box by setting the \Prado\Web\UI\WebControls\setTextMode property. If the TTextBox control is a multiline text box, the number of rows it displays is determined by the \Prado\Web\UI\WebControls\setRows property, and the \Prado\Web\UI\WebControls\setWrap property can be used to determine whether to wrap the text in the component. Additional \Prado\Web\UI\WebControls\setTextMode 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 \Prado\Web\UI\WebControls\setColumns property. To prevent the text displayed in the component from being modified, set the \Prado\Web\UI\WebControls\setReadOnly property to true. If you want to limit the user input to a specified number of characters, set the \Prado\Web\UI\WebControls\setMaxLength property. To use AutoComplete feature, set the \Prado\Web\UI\WebControls\setAutoCompleteType property.
If \Prado\Web\UI\WebControls\setAutoPostBack is set true, updating the text box and then changing the focus out of it will cause postback action. And if \Prado\Web\UI\WebControls\setCausesValidation is true, validation will also be processed, which can be further restricted within a \Prado\Web\UI\WebControls\setValidationGroup.
WARNING: Be careful if you want to display the text collected via TTextBox. Malicious cross-site script may be injected in. You may use \Prado\Web\UI\WebControls\getSafeText to prevent this problem.
NOTE: If you set \Prado\Web\UI\WebControls\setWrap to false or use \Prado\Web\UI\WebControls\setAutoCompleteType, the generated HTML output for the textbox will not be XHTML-compatible. Currently, no alternatives are available.
Class hierarchy
- \Prado\Web\UI\WebControls\TTextBox implements IPostBackDataHandler, IValidatable, IDataRenderer
- \Prado\Web\UI\WebControls\TWebControl implements IStyleable
- \Prado\Web\UI\TControl implements IRenderable, IBindable
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.0
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
getData() : string
Returns the text content of the TTextBox control.
This method is required by IDataRenderer. It is the same as getText(). |
public
|
getDataChanged() : bool
Returns a value indicating whether postback has caused the control data change.
This method is required by the \Prado\Web\UI\IPostBackDataHandler interface. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
getValidationPropertyValue() : mixed
Returns the value to be validated.
This methid is required by \Prado\Web\UI\IValidatable interface. |
public
|
|
public
|
loadPostData(string $key, array<string|int, mixed> $values) : bool
Loads user input data.
This method is primarly used by framework developers. |
public
|
onTextChanged(TEventParameter $param) : mixed
Raises <b>OnTextChanged</b> event.
This method is invoked when the value of the \Prado\Web\UI\WebControls\getText 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
|
raisePostDataChangedEvent() : mixed
Raises postdata changed event.
This method is required by IPostBackDataHandler interface. It is invoked by the framework when \Prado\Web\UI\WebControls\getText property is changed on postback. This method is primarly used by framework developers. |
public
|
renderBeginTag(THtmlWriter $writer) : mixed
Renders an additional line-break after the opening tag when it
is in MultiLine text mode.
|
public
|
renderContents(THtmlWriter $writer) : mixed
Renders the body content of the textbox when it is in MultiLine text mode.
|
public
|
|
public
|
setAutoPostBack(bool $value) : mixed
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. |
public
|
setAutoTrim(bool $value) : mixed
Sets the value indicating if the input text should be trimmed spaces
|
public
|
|
public
|
|
public
|
|
public
|
setData(string $value) : mixed
Sets the text content of the TTextBox control.
This method is required by IDataRenderer. It is the same as setText(). |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
setWrap(bool $value) : mixed
Sets the value indicating whether the text content wraps within a multiline text box.
|
protected
|
addAttributesToRender(THtmlWriter $writer) : mixed
Adds attribute name-value pairs to renderer.
This method overrides the parent implementation with additional textbox specific attributes. |
protected
|
getClientClassName() : string
Gets the name of the javascript class responsible for performing postback for this control.
This method overrides the parent implementation. |
protected
|
|
protected
|
|
protected
|
|
protected
|
public
mixed
|
DEFAULT_COLUMNS
Default number of columns (for MultiLine text box)
|
20
|
public
mixed
|
DEFAULT_ROWS
Default number of rows (for MultiLine text box)
|
4
|