Prado\Web\UI\WebControls\TListControlValidator::evaluateIsValid PHP Method

evaluateIsValid() protected method

The validation succeeds if the input component changes its data from the InitialValue or the input component is not given.
protected evaluateIsValid ( ) : boolean
return boolean whether the validation succeeds
    protected function evaluateIsValid()
    {
        $control = $this->getValidationTarget();
        $exists = true;
        $values = $this->getSelection($control);
        $count = count($values);
        $required = $this->getRequiredValues();
        //if required, check the values
        if (!empty($required)) {
            if ($count < count($required)) {
                return false;
            }
            foreach ($required as $require) {
                $exists = $exists && in_array($require, $values);
            }
        }
        $min = $this->getMinSelection();
        $max = $this->getMaxSelection();
        if ($min !== -1 && $max !== -1) {
            return $exists && $count >= $min && $count <= $max;
        } else {
            if ($min === -1 && $max !== -1) {
                return $exists && $count <= $max;
            } else {
                if ($min !== -1 && $max === -1) {
                    return $exists && $count >= $min;
                } else {
                    return $exists;
                }
            }
        }
    }