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


PHP Zend_Form::getErrors方法代码示例

本文整理汇总了PHP中Zend_Form::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form::getErrors方法的具体用法?PHP Zend_Form::getErrors怎么用?PHP Zend_Form::getErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form的用法示例。


在下文中一共展示了Zend_Form::getErrors方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetErrorsHonorsElementsBelongTo

 public function testGetErrorsHonorsElementsBelongTo()
 {
     $subForm = new \Zend\Form\SubForm();
     $subForm->setElementsBelongTo('foo[bar]');
     $subForm->addElement('text', 'test')->test->setRequired(true);
     $this->form->addSubForm($subForm, 'sub');
     $data = array('foo' => array('bar' => array('test' => '')));
     $this->form->isValid($data);
     $codes = $this->form->getErrors();
     $this->assertFalse(empty($codes['foo']['bar']['test']));
 }
开发者ID:rafalwrzeszcz,项目名称:zf2,代码行数:11,代码来源:FormTest.php

示例2: saveAction

 public function saveAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     $message = array("success" => 0, "message" => "Please Correct the Errors Below!");
     if ($this->_addForm->isValid($_POST)) {
         //As everything is ok, save it...
         $task = $this->_dataTable->createRow();
         $task->name = $this->_addForm->getElement("name")->getValue();
         $task->description = $this->_addForm->getElement("desc")->getValue();
         $time = $this->_addForm->getElement("end_date")->getValue();
         if (!empty($time)) {
             $task->end_date = date("Y-m-d", strtotime($time));
         }
         $task->status = Task::STATUS_OPEN;
         $task->save();
         $message["success"] = 1;
         $message["message"] = "Task is saved successfully! Wait For Redirection!";
     } else {
         $message["errors"] = $this->_addForm->getErrors();
     }
     echo json_encode($message);
 }
开发者ID:radalin,项目名称:pgday2012-task,代码行数:22,代码来源:IndexController.php

示例3: getErrors

 function getErrors($name = null, $suppressArrayNotation = false)
 {
     $e = parent::getErrors($name, $suppressArrayNotation);
     if ($e) {
         foreach ($e as &$el) {
             if ($el) {
                 foreach ($el as &$el_1) {
                     $el_1 = $this->translateError($el_1);
                 }
             }
         }
     }
     return $e;
 }
开发者ID:s-kalaus,项目名称:zkernel,代码行数:14,代码来源:Form.php

示例4: isFormElementError

 /**
  * Main method
  * @param string The form object
  * @param string Name of the element
  * @return boolean
  */
 public function isFormElementError(Zend_Form $form, $element)
 {
     return isset($form->getErrors($element));
 }
开发者ID:brunopbaffonso,项目名称:ongonline,代码行数:10,代码来源:IsFormElementError.php

示例5: mergeErrors

 /**
  * Helper function to merge different types of error.
  *
  * @param \Zend_Form $form    The form.
  * @param string     $element The name of the element.
  *
  * @return array
  */
 public static function mergeErrors($form, $elementName)
 {
     $elementErrors = $form->getErrors($elementName);
     $element = $form->getElement($elementName);
     if ($element && method_exists($element, 'getErrorMessages')) {
         $elementCustomErrors = $element->getErrorMessages();
     }
     if (!is_array($elementErrors)) {
         $elementErrors = array();
     }
     if (!is_array($elementCustomErrors)) {
         $elementCustomErrors = array();
     }
     return array_merge($elementErrors, $elementCustomErrors);
 }
开发者ID:namesco,项目名称:ztal,代码行数:23,代码来源:Form.php


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