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

getClientScriptOptions() protected method

Returns an array of javascript validator options.
protected getClientScriptOptions ( ) : array
return array javascript validator options.
    protected function getClientScriptOptions()
    {
        $options = parent::getClientScriptOptions();
        $control = $this->getValidationTarget();
        if (!$control instanceof TListControl) {
            throw new TConfigurationException('listcontrolvalidator_invalid_control', $this->getID(), $this->getControlToValidate(), get_class($control));
        }
        $min = $this->getMinSelection();
        $max = $this->getMaxSelection();
        if ($min !== -1) {
            $options['Min'] = $min;
        }
        if ($max !== -1) {
            $options['Max'] = $max;
        }
        $required = $this->getRequiredSelections();
        if (strlen($required) > 0) {
            $options['Required'] = $required;
        }
        $options['TotalItems'] = $control->getItemCount();
        return $options;
    }