public function validate(Control $control): bool
  {
    $value = $control->getSubmittedValue();

    // An empty value is valid.
    if ($value==='' || $value===null || $value===false)
    {
      return true;
    }

    // Objects and arrays are not valid.
    if (!is_scalar($value))
    {
      return false;
    }

    $length = mb_strlen($value, Html::$encoding);

    return (($this->minLength<=$length) && ($length<=$this->maxLength));
  }