當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Form::getErrors方法代碼示例

本文整理匯總了PHP中Nette\Application\UI\Form::getErrors方法的典型用法代碼示例。如果您正苦於以下問題:PHP Form::getErrors方法的具體用法?PHP Form::getErrors怎麽用?PHP Form::getErrors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nette\Application\UI\Form的用法示例。


在下文中一共展示了Form::getErrors方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: FormError

 /**
  * Odeslání formuláře s Errory
  * @param Form $form
  */
 public function FormError(Form $form)
 {
     $json = new \stdClass();
     $json->result = "error";
     $json->message = implode("<br />", $form->getErrors());
     $json->notify = implode(",", $form->getErrors());
     $response = new JsonResponse($json);
     $this->getPresenter()->sendResponse($response);
 }
開發者ID:vipercz,項目名稱:sandbox,代碼行數:13,代碼來源:BaseControl.php

示例2: quickPickFormError

 public function quickPickFormError(Form $form)
 {
     if ($form->hasErrors() && $this->presenter->isAjax()) {
         $errors = $form->getErrors();
         $error = array_shift($errors);
         $this->presenter->payload->error = true;
         $this->presenter->payload->message = $error;
         $this->presenter->sendPayload();
     }
 }
開發者ID:rostenkowski,項目名稱:vstore,代碼行數:10,代碼來源:QuickPick.php

示例3: renderAllErrors

    public function renderAllErrors(UI\Form $form)
    {
        $html = '';
        foreach ($form->getErrors() as $error) {
            $html .= '<div class="alert alert-danger">
							<a class="close" data-dismiss="alert">×</a>' . $error . '
						</div>';
        }
        $errors = new Html();
        $errors->setHtml($html);
        return $errors;
    }
開發者ID:jirinapravnik,項目名稱:common,代碼行數:12,代碼來源:Bs3FormRenderer.php

示例4: formError

 /**
  * Process form if error occurs.
  * @param  void
  */
 public function formError(Form $form)
 {
     $errors = $form->getErrors();
     foreach ($errors as $error) {
         $this->presenter->flashMessage($error, "error");
     }
     switch ($form->name) {
         case "formEdit":
             $this->handleEdit();
             break;
         case "formUpload":
             $this->handleUpload();
             break;
     }
 }
開發者ID:Repticus,項目名稱:CorpGuide,代碼行數:19,代碼來源:Annex.php

示例5: validateAddArticleForm

 public function validateAddArticleForm(Form $form)
 {
     $values = (object) $form->getHttpData();
     if ($values->publishedAt == "later") {
         $later = DateTimeUtils::createDbDatetimeFormatFromDateParts($values->year, $values->month, $values->day, $values->hour, $values->minute, "0");
         $valid = DateTimeUtils::createDateTime(DateTimeUtils::DB_DATETIME_FORMAT, $later);
         if (!$valid) {
             $form->addError("Zadej prosím platné datum");
         }
     }
     if ($values->photoId == 0) {
         $form->addError("Vyber prosím fotografii ke článku.");
     }
     if (!isset($values->tagList)) {
         $tagList = null;
         $form->addError("Zadej prosím alespoň jeden tag ke článku.");
     } else {
         $tagList = new TagCollection();
         foreach ($values->tagList as $tag) {
             $tagList->addItem(TagService::create($tag));
         }
     }
     $articleId = $form->getPresenter()->getParameter("articleId");
     if (count($form->getErrors()) > 0) {
         if ($articleId) {
             $form->getPresenter()->actionEdit(null, $tagList, $values->photoId);
         } else {
             $form->getPresenter()->actionAdd($tagList, $values->photoId);
         }
     }
 }
開發者ID:jaromir92,項目名稱:Sportwin,代碼行數:31,代碼來源:AddArticleForm.php

示例6: onFormError

 /**
  * @author Petr Besir Horacek <sirbesir@gmail.com>
  * @param \Nette\Application\UI\Form $form
  * @return boolean
  */
 public function onFormError(\Nette\Application\UI\Form $form)
 {
     $errors = $form->getErrors();
     foreach ($errors as $error) {
         if ($this->getToGlobalFlashes()) {
             $this->getPresenter()->flashMessage($error, 'error');
         } else {
             $this->flashMessage('Při odesílání zprávy došlo k neznámé chybě. Zkuste to prosím později.', 'error');
         }
     }
     return FALSE;
 }
開發者ID:besir,項目名稱:besir.cz,代碼行數:17,代碼來源:contactMe.php


注:本文中的Nette\Application\UI\Form::getErrors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。