本文整理汇总了PHP中Zend_Form::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form::reset方法的具体用法?PHP Zend_Form::reset怎么用?PHP Zend_Form::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form
的用法示例。
在下文中一共展示了Zend_Form::reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: detailAction
public function detailAction()
{
$newsUrl = $this->getRequest()->getParam('url', null);
try {
$news = $this->newsRepository->fetchEntityByUrl($newsUrl);
} catch (\Exception $e) {
throw new \Exception($e->getMessage(), 404);
}
$this->view->headTitle($news->headline);
$this->view->headMeta()->setName('description', $this->_helper->truncate($news->content, 255));
$configForm = $this->getInvokeArg('bootstrap')->getResource('configForm');
$commentForm = new \Zend_Form($configForm->comment);
if ($this->getRequest()->isPost()) {
if ($commentForm->isValid($_POST)) {
try {
$values = $commentForm->getValues();
unset($values['csrf']);
unset($values['firstname']);
# SpamDetection
$values['news'] = $news;
$this->commentRepository->saveEntity($values);
$commentForm->reset();
#$this->_helper->systemMessages('notice', 'Kommentar erfolgreich gespeichert');
} catch (\Exception $e) {
$log = $this->getInvokeArg('bootstrap')->log;
$log->log($e->getMessage(), \Zend_Log::ERR, array('trace' => $e->getTraceAsString()));
#$this->_helper->systemMessages('error', 'Kommentar konnte nicht gespeichert werden');
}
}
}
$commentForm->setAction('/news/' . $newsUrl);
$this->view->form = $commentForm;
$this->view->news = $news;
}
示例2: testFormsShouldAllowResetting
/**
* @group ZF-3227
*/
public function testFormsShouldAllowResetting()
{
$form = new Zend_Form();
$foo = new Zend_Form_SubForm(array('name' => 'foo', 'elements' => array('one' => 'text', 'two' => 'text')));
$form->addElement('text', 'bar')->addElement('text', 'baz')->addElement('text', 'bat')->addDisplayGroup(array('bar', 'bat'), 'barbat')->addSubForm($foo, 'foo');
$values = array('bar' => 'Bar Value', 'baz' => 'Baz Value', 'bat' => 'Bat Value', 'foo' => array('one' => 'One Value', 'two' => 'Two Value'));
$form->populate($values);
$test = $form->getValues();
$this->assertEquals($values, $test);
$form->reset();
$test = $form->getValues();
$this->assertNotEquals($values, $test);
$this->assertEquals(0, array_sum($test));
}
示例3: reset
/**
* Reset values of form
*
* @return Zend_Form
*/
public function reset()
{
$this->getSessionNamespace()->unsetAll();
return parent::reset();
}