当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form::reset方法代码示例

本文整理汇总了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;
 }
开发者ID:kromeyer,项目名称:MMK-Newsroom,代码行数:34,代码来源:NewsController.php

示例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));
 }
开发者ID:vicfryzel,项目名称:zf,代码行数:17,代码来源:FormTest.php

示例3: reset

 /**
  * Reset values of form
  *
  * @return Zend_Form
  */
 public function reset()
 {
     $this->getSessionNamespace()->unsetAll();
     return parent::reset();
 }
开发者ID:uglide,项目名称:zfcore-transition,代码行数:10,代码来源:Multipage.php


注:本文中的Zend_Form::reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。