Inheritance: extends Form_Field
Example #1
0
 function getInput()
 {
     $s = $this->name . '_slider';
     $this->js(true)->_selector('#' . $s)->slider(array('min' => $this->min, 'max' => $this->max, 'step' => $this->step, 'range' => true, 'values' => array($this->selected_min, $this->selected_max), 'change' => $this->js()->_enclose()->val($this->js()->_selector('#' . $s)->slider('values'))->change()));
     $this->setAttr('style', 'display: none');
     return '<div class="atk-cells"><div class="atk-cell atk-align-left">' . $this->left . '</div>' . '<div class="atk-cell atk-align-right">' . $this->right . '</div>' . '</div>' . '' . parent::getInput() . '<div id="' . $s . '"></div>' . '';
 }
Example #2
0
 function get()
 {
     $value = parent::get();
     // date cannot be empty string
     if ($value == '') {
         return null;
     }
     return $value;
 }
 function validate()
 {
     // we must regenerate code if validation fails
     $result = parent::validate();
     if (!$result) {
         unset($_SESSION['S_IMAGE_DECODED']);
         $this->generateCode();
     }
     return $result;
 }
Example #4
0
 function validate()
 {
     // empty value is allowed
     if ($this->value != '') {
         if (!is_numeric($this->value)) {
             $this->displayFieldError('Not a valid number');
         }
         if ($this->min !== null && $this->value < $this->min || $this->max !== null && $this->value > $this->max) {
             $this->displayFieldError('Number not in valid range');
         }
     }
     return parent::validate();
 }
Example #5
0
 function init()
 {
     parent::init();
     // Calculate URL for the map lookup callback
     $this->addr_url = $this->add('VirtualPage', 'getaddr')->set(function ($p) {
         echo json_encode($p->add('rvadym\\gmap\\Form_WithMap')->getCoordByAddr($_GET['addr']));
         exit;
     })->getURL();
     $this->button = $this->afterField()->add('Button')->setLabel('Map');
     $this->flyout = $this->owner->add('View_Flyout', 'mapframe');
     $this->page_Map($this->flyout);
     $this->button->js('click', array($this->flyout->showJS($this->button, array('width' => 500, 'my' => 'right top')), $this->map->js()->trigger('redraw'), $this->flyout->js()->gm_field('lookup')));
 }
 function render()
 {
     $this->js(true)->_load('bootstrap-timepicker.min')->timepicker($this->options)->focus($this->js()->next()->trigger('click'));
     parent::render();
 }
Example #7
0
 function getInput($attr = array())
 {
     return parent::getInput(array_merge(array('value' => number_format($this->value, 2)), $attr));
 }
Example #8
0
File: Number.php Project: atk4/atk4
 public function performValidation()
 {
     parent::performValidation();
     $this->validate('number');
 }
Example #9
0
 function setForm($form)
 {
     parent::setForm($form);
     $this->validate('number');
 }
Example #10
0
 function getInput()
 {
     return parent::getInput() . $this->getButton();
 }
Example #11
0
 function init()
 {
     parent::init();
     $btn = $this->afterField()->add('Button')->set("Select " . $this->short_name);
     $btn->js('click')->_load('elimage')->univ()->myelimage($this);
 }
Example #12
0
 function getInput($attr = array())
 {
     return parent::getInput(array_merge(array('class' => 'hindi'), $attr));
 }