Example #1
0
 /**
  * This control only validates if it's clicked
  * @return array If empty, no errors.  One string element describing each error
  */
 public function validate()
 {
     if (isset($_POST[$this->input_name()])) {
         return parent::validate();
     }
     return array();
 }
Example #2
0
 /**
  * Runs any attached validation functions to check validation of each control contained in this fieldset.
  *
  * @return array An array of string validation error descriptions or an empty array if no errors were found.
  */
 function validate()
 {
     /** @var FormControl $control */
     $results = array();
     foreach ($this->controls as $control) {
         if ($result = $control->validate()) {
             $results = array_merge($results, $result);
         }
     }
     $results = array_merge($results, parent::validate());
     return $results;
 }