/**
  * Registers the needed JavaScript.
  */
 public function registerClientScript()
 {
     $options = $this->getClientOptions();
     $options = empty($options) ? '' : ',' . Json::encode($options);
     $js = '';
     if (is_array($this->charMap) && !empty($this->charMap)) {
         $js .= 'jQuery.mask.definitions=' . Json::encode($this->charMap) . ";\n";
     }
     $id = $this->options['id'];
     $js .= "jQuery(\"#{$id}\").mask(\"{$this->mask}\"{$options});";
     $view = $this->getView();
     MaskedInputAsset::register($view);
     $view->registerJs($js);
 }
Exemplo n.º 2
0
 /**
  * Registers the needed client script and options.
  */
 public function registerClientScript()
 {
     $js = '';
     $view = $this->getView();
     $this->initClientOptions();
     if (!empty($this->mask)) {
         $this->clientOptions['mask'] = $this->mask;
     }
     $this->hashPluginOptions($view);
     if (is_array($this->definitions) && !empty($this->definitions)) {
         $js .= '$.extend($.' . self::PLUGIN_NAME . '.defaults.definitions, ' . Json::htmlEncode($this->definitions) . ");\n";
     }
     if (is_array($this->aliases) && !empty($this->aliases)) {
         $js .= '$.extend($.' . self::PLUGIN_NAME . '.defaults.aliases, ' . Json::htmlEncode($this->aliases) . ");\n";
     }
     $id = $this->options['id'];
     $js .= '$("#' . $id . '").' . self::PLUGIN_NAME . "(" . $this->_hashVar . ");\n";
     MaskedInputAsset::register($view);
     $view->registerJs($js);
 }
 /**
  * регистрирует необходимые скрипты для работы maskedInput jquery plugin.
  * 
  * если используется range date picker - маска будет применена и для второго поля.
  * 
  */
 public function registerClientScript()
 {
     $element = "jQuery('#" . $this->options['id'] . "')";
     MaskedInputAsset::register($this->getView());
     $this->registerPlugin('inputmask', $element);
     if (isset($this->options2['id'])) {
         $element2 = "jQuery('#" . $this->options2['id'] . "')";
         $this->registerPlugin('inputmask', $element2);
     }
 }
Exemplo n.º 4
0
 /**
  * Registers the needed client script and options.
  */
 public function registerClientScript()
 {
     $js = '';
     $view = $this->getView();
     $this->initClientOptions();
     if (!empty($this->mask)) {
         $this->clientOptions['mask'] = $this->mask;
     }
     $this->hashPluginOptions($view);
     if (is_array($this->definitions) && !empty($this->definitions)) {
         $js .= ucfirst(self::PLUGIN_NAME) . '.extendDefinitions(' . Json::htmlEncode($this->definitions) . ');';
     }
     if (is_array($this->aliases) && !empty($this->aliases)) {
         $js .= ucfirst(self::PLUGIN_NAME) . '.extendAliases(' . Json::htmlEncode($this->aliases) . ');';
     }
     $id = $this->options['id'];
     $js .= 'jQuery("#' . $id . '").' . self::PLUGIN_NAME . '(' . $this->_hashVar . ');';
     MaskedInputAsset::register($view);
     $view->registerJs($js);
 }
Exemplo n.º 5
0
 /**
  * Registers Bootstrap File Input plugin
  */
 public function registerClientScript()
 {
     $view = $this->getView();
     MaskedInputAsset::register($view);
 }