src/Form.php
public function error($fieldName, $str)
    {
        // by using this hook you can overwrite default behavior of this method
        if ($this->hookHasCallbacks('displayError')) {
            return $this->hook('displayError', [$fieldName, $str]);
        }

        $jsError = [$this->js()->form('add prompt', $fieldName, $str)];

        return $jsError;
    }
public function error($fieldName, $str)
    {
        // by using this hook you can overwrite default behavior of this method
        if ($this->hookHasCallbacks('displayError')) {
            return $this->hook('displayError', [$fieldName, $str]);
        }

        $jsError = [$this->js()->form('add prompt', $fieldName, $str)];

        return $jsError;
    }
public function error ( $ fieldName , $ str ) { // by using this hook you can overwrite default behavior of this method if ( $ this -> hookHasCallbacks ( 'displayError' ) ) { return $ this -> hook ( 'displayError' , [ $ fieldName , $ str ] ) ; } $ jsError = [ $ this -> js ( ) -> form ( 'add prompt' , $ fieldName , $ str ) ] ; return $ jsError ; }
Causes form to generate error.

@param string $fieldName Field name
@param string $str       Error message

@return jsChain|array
Causes form to generate error .