提交后如何清除伏特视图中的表格?

How to clear form in volt view after submit?

这是提交前的视图:

我填表提交后,使用volt时录入记录还在

我怎样才能清除它? 这是我的表格:

class BataorderForm extends \Phalcon\Forms\Form{
    public function initialize(){

        $protComsId   = new Select('protComsId',CompanyMaster::find(),[
            'class'         => 'btn btn-default btn-block',
            'using'         => ['comsId','comsName'],
            'useEmpty'      => true,
            'emptyText'     => '-- Choose Company --',
            'emptyValue'    => ''
        ]);
        $protComsId->setLabel('Company Master');
        $this->add($protComsId);
}

要重置表单中的每个元素,您必须调用方法 clear()

控制器用法示例:

$form = new YourForm();
if ($this->request->isPost() AND $this->security->checkToken() AND $form->isValid($this->request->getPost())) {
    // Form is valid
} else {
    // Form is not valid. Let's reset it to annoy our user :)
    $form->clear();
}
$this->view->form = $form;

有关表单方法的更多信息,请参见 Documentation