Esempio n. 1
0
 function validateEntry($value)
 {
     $config = $this->getConfiguration();
     parent::validateEntry($value);
     if (!$value) {
         return;
     }
     if ($config['min'] and $value < $config['min']) {
         $this->_errors[] = 'Selected date is earlier than permitted';
     } elseif ($config['max'] and $value > $config['max']) {
         $this->_errors[] = 'Selected date is later than permitted';
     } elseif ($value === -1 or $value === false) {
         $this->_errors[] = 'Enter a valid date';
     }
 }
Esempio n. 2
0
 function validateEntry($item)
 {
     $config = $this->getConfiguration();
     parent::validateEntry($item);
     if ($item && !$item instanceof DynamicListItem) {
         $this->_errors[] = 'Select a value from the list';
     } elseif ($item && $config['typeahead'] && $this->getWidget()->getEnteredValue() != $item->get('value')) {
         $this->_errors[] = 'Select a value from the list';
     }
 }
 function validateEntry($entry)
 {
     parent::validateEntry($entry);
     if (!$this->errors()) {
         $config = $this->getConfiguration();
         if ($config['typeahead'] && ($entered = $this->getWidget()->getEnteredValue()) && !in_array($entered, $entry)) {
             $this->_errors[] = __('Select a value from the list');
         }
     }
 }