protected function SetRequired($name, $errorPrefix = '')
    {
        $field = $this->GetElement($name);
        if (!$field instanceof FormField)
        {
            throw new \InvalidArgumentException("$name is not a field in the form elements");
        }
        if (!$errorPrefix)
        {
            $errorPrefix = $this->ErrorPrefix($name);
        }
        $field->SetRequired($errorPrefix);
    }
protected function SetRequired($name, $errorPrefix = '')
    {
        $field = $this->GetElement($name);
        if (!$field instanceof FormField)
        {
            throw new \InvalidArgumentException("$name is not a field in the form elements");
        }
        if (!$errorPrefix)
        {
            $errorPrefix = $this->ErrorPrefix($name);
        }
        $field->SetRequired($errorPrefix);
    }
protected function SetRequired ( $ name , $ errorPrefix = '' ) { $ field = $ this -> GetElement ( $ name ) ; if ( ! $ field instanceof FormField ) { throw new \ InvalidArgumentException ( "$name is not a field in the form elements" ) ; } if ( ! $ errorPrefix ) { $ errorPrefix = $ this -> ErrorPrefix ( $ name ) ; } $ field -> SetRequired ( $ errorPrefix ) ; }
Sets the field as required
@param string $name The name of the required field
@param string $errorPrefix The label prefix, auto calculated if omitted
Sets the field as required