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 (qiang.xue@gmail.com)
Inheritance: extends TWebControl, implements Prado\Web\UI\IPostBackDataHandler, implements Prado\Web\UI\IValidatable, implements Prado\IDataRenderer
コード例 #1
0
 protected function createMultiLineControl($container, $column, $record)
 {
     $value = $this->getRecordPropertyValue($column, $record);
     $control = new TTextBox();
     $control->setText($value);
     $control->setTextMode(TTextBoxMode::MultiLine);
     $control->setCssClass('multiline-textbox scaffold_input');
     $this->setNotNullProperty($container, $control, $column, $record);
     return $control;
 }
コード例 #2
0
ファイル: TActiveTextBox.php プロジェクト: pradosoft/prado
 /**
  * Ensure that the ID attribute is rendered and registers the javascript code
  * for initializing the active control.
  */
 protected function addAttributesToRender($writer)
 {
     parent::addAttributesToRender($writer);
     $writer->addAttribute('id', $this->getClientID());
     $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions());
 }
コード例 #3
0
ファイル: TColorPicker.php プロジェクト: pradosoft/prado
 /**
  * Renders additional body content.
  * This method overrides parent implementation by adding
  * additional color picker button.
  * @param THtmlWriter writer
  */
 public function renderEndTag($writer)
 {
     parent::renderEndTag($writer);
     $color = $this->getText();
     $writer->addAttribute('class', 'TColorPicker_button');
     $writer->renderBeginTag('span');
     $writer->addAttribute('id', $this->getClientID() . '_button');
     $writer->addAttribute('src', $this->getAssetUrl('button.gif'));
     if ($color !== '') {
         $writer->addAttribute('style', "background-color:{$color};");
     }
     $writer->addAttribute('width', '20');
     $writer->addAttribute('height', '20');
     $writer->addAttribute('alt', '');
     $writer->renderBeginTag('img');
     $writer->renderEndTag();
     $writer->renderEndTag();
 }
コード例 #4
0
ファイル: THtmlArea4.php プロジェクト: pradosoft/prado
 /**
  * Adds attribute name-value pairs to renderer.
  * This method overrides the parent implementation by registering
  * additional javacript code.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 protected function addAttributesToRender($writer)
 {
     if ($this->getEnableVisualEdit() && $this->getEnabled(true)) {
         $writer->addAttribute('id', $this->getClientID());
         $this->registerEditorClientScript($writer);
     }
     parent::addAttributesToRender($writer);
 }
コード例 #5
0
ファイル: TInPlaceTextBox.php プロジェクト: pradosoft/prado
 /**
  * Update ClientSide Readonly property
  * @param boolean value
  * @since 3.1.2
  */
 public function setReadOnly($value)
 {
     $value = TPropertyValue::ensureBoolean($value);
     if (TTextBox::getReadOnly() === $value) {
         return;
     }
     TTextBox::setReadOnly($value);
     if ($this->getActiveControl()->canUpdateClientSide()) {
         $this->callClientFunction('setReadOnly', $value);
     }
 }
コード例 #6
0
ファイル: TDatePicker.php プロジェクト: pradosoft/prado
 /**
  * Add the client id to the input textbox, and register the client scripts.
  * @param THtmlWriter writer
  */
 protected function addAttributesToRender($writer)
 {
     parent::addAttributesToRender($writer);
     $writer->addAttribute('id', $this->getClientID());
 }