/**
  * Re-implements the notify() method to both mark the main field as well as the
  * reference field as invalid and notify both control's listeners.
  *
  * @author Christian Achatz
  * @version
  * Version 0.1, 12.09.2009<br />
  */
 public function notify()
 {
     $this->control->markAsInvalid();
     $this->refControl->markAsInvalid();
     $this->markControl($this->control);
     $this->markControl($this->refControl);
     $this->notifyValidationListeners($this->control);
     $this->notifyValidationListeners($this->refControl);
 }
 public function isActive()
 {
     return $this->button->isSent();
 }
示例#3
0
 /**
  * Evaluates the regular expression that is used for filtering the
  * control's input. In case the developer has defined a custom
  * regexp it is returned instead of the default value.
  *
  * @param String $default The default filter expression.
  *
  * @return string The effective filter expression.
  *
  * @since 1.14
  * @author Christian Achatz
  * @version
  * Version 0.1, 21.04.2011<br />
  */
 protected function getFilterExpression($default)
 {
     $expr = $this->control->getAttribute('filter-expr');
     return $expr === null ? $default : $expr;
 }
示例#4
0
 /**
  * Notifies all validation listeners, who's control attribute is the same
  * as the name of the present control. This enables you to insert listener
  * tags, that output special content if notified. Hence, you can realize
  * special error formatting.
  * <p/>
  * In case the name of the special validator is unlike <em>null</em>, all
  * listeners will be notified, that have the <em>validator</em> attribute
  * specified. This lets you define dedicated listener, that are only
  * displayed when triggered by a special validator.
  *
  * @param FormControl $control The control who's listeners should be notified.
  *
  * @author Christian Achatz
  * @version
  * Version 0.1, 30.08.2009<br />
  * Version 0.2, 12.02.2010 (Moved to TextFieldValidator and introduced special listener notification)<br />
  */
 protected function notifyValidationListeners(FormControl &$control)
 {
     $form = $control->getForm();
     /* @var $listeners ValidationListenerTag[] */
     $listeners = $form->getFormElementsByTagName('form:listener');
     $count = count($listeners);
     $controlName = $control->getAttribute('name');
     $validatorName = $this->getValidatorName();
     for ($i = 0; $i < $count; $i++) {
         // Here, we're using a little trick: empty attributes are considered "null"
         // by the XmlParser. Thus, we can set the validator name to null to
         // indicate, that we want a "normal" listener (=no special listener) to be
         // notified!
         if ($listeners[$i]->getAttribute('control') === $controlName && $listeners[$i]->getAttribute('validator') === $validatorName) {
             $listeners[$i]->notify();
         }
     }
 }
示例#5
0
 private function getMarkerClass(FormControl &$control)
 {
     $marker = $control->getAttribute(AbstractFormValidator::$CUSTOM_MARKER_CLASS_ATTRIBUTE);
     if (empty($marker)) {
         $marker = AbstractFormValidator::$DEFAULT_MARKER_CLASS;
     }
     return $marker;
 }