src/Form.php
public function success($str = 'Success', $sub_header = null)
    {
        // by using this hook you can overwrite default behavior of this method
        if ($this->hookHasCallbacks('displaySuccess')) {
            return $this->hook('displaySuccess', [$str, $sub_header]);
        }

        /* below code works, but pollutes output with bad id=xx
        $success = new Message([$str, 'id'=>false, 'type'=>'success', 'icon'=>'check']);
        $success->app = $this->app;
        $success->init();
        $success->text->addParagraph($sub_header);
         */
        $success = $this->app->loadTemplate($this->successTemplate);
        $success['header'] = $str;

        if ($sub_header) {
            $success['message'] = $sub_header;
        } else {
            $success->del('p');
        }

        $js = $this->js()
            ->html($success->render());

        return $js;
    }
public function success($str = 'Success', $sub_header = null)
    {
        // by using this hook you can overwrite default behavior of this method
        if ($this->hookHasCallbacks('displaySuccess')) {
            return $this->hook('displaySuccess', [$str, $sub_header]);
        }

        /* below code works, but pollutes output with bad id=xx
        $success = new Message([$str, 'id'=>false, 'type'=>'success', 'icon'=>'check']);
        $success->app = $this->app;
        $success->init();
        $success->text->addParagraph($sub_header);
         */
        $success = $this->app->loadTemplate($this->successTemplate);
        $success['header'] = $str;

        if ($sub_header) {
            $success['message'] = $sub_header;
        } else {
            $success->del('p');
        }

        $js = $this->js()
            ->html($success->render());

        return $js;
    }
public function success ( $ str = 'Success' , $ sub_header = null ) { // by using this hook you can overwrite default behavior of this method if ( $ this -> hookHasCallbacks ( 'displaySuccess' ) ) { return $ this -> hook ( 'displaySuccess' , [ $ str , $ sub_header ] ) ; } /* below code works, but pollutes output with bad id=xx
        $success = new Message([$str, 'id'=>false, 'type'=>'success', 'icon'=>'check']);
        $success->app = $this->app;
        $success->init();
        $success->text->addParagraph($sub_header);
         */ $ success = $ this -> app -> loadTemplate ( $ this -> successTemplate ) ; $ success [ 'header' ] = $ str ; if ( $ sub_header ) { $ success [ 'message' ] = $ sub_header ; } else { $ success -> del ( 'p' ) ; } $ js = $ this -> js ( ) -> html ( $ success -> render ( ) ) ; return $ js ; }
Causes form to generate success message.

@param string $str        Success message
@param string $sub_header Sub-header

@return jsChain
Causes form to generate success message .