當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。