TActiveTextBox allows the {@link setText Text} property of the textbox to be changed during callback. When {@link setAutoPostBack AutoPostBack} property is true, changes to the textbox contents will perform a callback request causing {@link onTextChanged OnTextChanged} to be fired first followed by {@link onCallback OnCallback} event.
Since: 3.1
Inheritance: extends Prado\Web\UI\WebControls\TTextBox, implements Prado\Web\UI\ActiveControls\ICallbackEventHandler, implements Prado\Web\UI\ActiveControls\IActiveControl
Example #1
0
 /**
  * @return array list of callback options.
  */
 protected function getPostBackOptions()
 {
     //disallow page state update ?
     //$this->getActiveControl()->getClientSide()->setEnablePageStateUpdate(false);
     $options = array();
     if (strlen($string = $this->getSeparator())) {
         $string = strtr($string, array('\\t' => "\t", '\\n' => "\n", '\\r' => "\r"));
         $token = preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY);
         $options['tokens'] = $token;
     }
     if ($this->getAutoPostBack()) {
         $options = array_merge($options, parent::getPostBackOptions());
         $options['AutoPostBack'] = true;
     }
     if (strlen($select = $this->getTextCssClass())) {
         $options['select'] = $select;
     }
     $options['ResultPanel'] = $this->getResultPanel()->getClientID();
     $options['ID'] = $this->getClientID();
     $options['EventTarget'] = $this->getUniqueID();
     if (($minchars = $this->getMinChars()) !== '') {
         $options['minChars'] = $minchars;
     }
     if (($frequency = $this->getFrequency()) !== '') {
         $options['frequency'] = $frequency;
     }
     $options['CausesValidation'] = $this->getCausesValidation();
     $options['ValidationGroup'] = $this->getValidationGroup();
     return $options;
 }
Example #2
0
 /**
  * @return array list of callback options.
  */
 protected function getPostBackOptions()
 {
     $options = $this->getOptions()->toArray();
     if (strlen($separator = $this->getSeparator())) {
         $options['Separators'] = $separator;
     }
     if ($this->getAutoPostBack()) {
         $options = array_merge($options, parent::getPostBackOptions());
         $options['AutoPostBack'] = true;
     }
     if (strlen($textCssClass = $this->getTextCssClass())) {
         $options['textCssClass'] = $textCssClass;
     }
     $options['minLength'] = $this->getMinChars();
     $options['delay'] = $this->getFrequency() * 1000.0;
     $options['appendTo'] = '#' . $this->getResultPanel()->getClientID();
     $options['ID'] = $this->getClientID();
     $options['EventTarget'] = $this->getUniqueID();
     $options['CausesValidation'] = $this->getCausesValidation();
     $options['ValidationGroup'] = $this->getValidationGroup();
     return $options;
 }
Example #3
0
 /**
  * Ensure that the ID attribute is rendered and registers the javascript code
  * for initializing the active control. Also registers language specific global
  * settings for the first used date picker.
  */
 protected function addAttributesToRender($writer)
 {
     $cs = $this->getPage()->getClientScript();
     if (self::$_first) {
         $code = "jQuery(document).ready(function(){jQuery.datepicker.setDefaults(jQuery.datepicker.regional['{$this->getCurrentCulture()}']);});";
         $cs->registerEndScript(sprintf('%08X', crc32($code)), $code);
         self::$_first = false;
     }
     parent::addAttributesToRender($writer);
     $options = TJavaScript::encode($this->getOptions()->toArray());
     $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");";
     $cs->registerEndScript(sprintf('%08X', crc32($code)), $code);
 }
Example #4
0
 /**
  * Registers CSS and JS.
  * This method is invoked right before the control rendering, if the control is visible.
  * @param mixed event parameter
  */
 public function onPreRender($param)
 {
     parent::onPreRender($param);
     $this->registerClientScript();
 }